I am writing a plugin and there are some data(stored in a file) that I want to display to users when users toggle this feature.
What is the proper way to implement this? I guess I could use :new or ':view` to display the file as a buffer, are there better ways to do it?
I am thinking something similar to the window generated by:help, however I don't know how to do it properly.
Related
I regularly have to program small applications for several very specific situations.
My mother language is Dutch so I define my variables in Dutch.
When I write this programs I try to use VIM.
In most of my programs I use the same syntax, so I wanted to make my own auto complete library. But because I have to switch regularly between language (from lisp to latex for example). Specifically I want to be able to load a library after I started vim.
I don't have a clue about how this library should look, but the easiest thing I could come up with is a word on every line.
set complete+=k
set dict+=~/path/to/dict
The cool thing about VIM is autocomplete happens from any open buffer. In my opinion, you can load an "autocomplete file" in a buffer, then open your source file that you're going to work on, which will open in in another buffer, and you will get all your autocomplete goodness. This will allow you to open and close whatever buffers you want autocomplete to recognize. Effectively customizing your autocomplete for that particular session.
Does anyone know some shortcuts for FakeVim to change between files?
Is it possible to use buffers in Fake Vim? I accidentally found out that Ctrl+w,w gets you the next window. Does anyone know other? For example getting to the left, right, top, bottom windows?(vim's Ctrl+w,l and others)? Is there any documentation on FakeVim? Is it possible to configure FakeVim's vimrc file to create shortcuts for changing between buffers and the Projects view?
Thanks!
Recently I've been doing most of the changes on FakeVim plugin.
You can find list of Vim commands supported by FakeVim at https://github.com/hluk/FakeVim (recent version from Git master branch).
I'm still not sure how to document the features in Qt Creator. I'll probably implement something like :help <command> in near future.
The FakeVim documentation is severely lacking. This paragraph, for example, is so fuzzy it's borderline irresponsible:
In the FakeVim mode, most keystrokes in the main editor will be intercepted and interpreted in a way that resembles Vim. Documentation for Vim is not included in Qt Creator. For more information on using Vim, see Documentation on the Vim web site.
Basically, without a proper documentation or a look at the editor's source code it's impossible to know what should work, what shouldn't and in which way the behavior of what works deviates from Vim's behavior. And that's what passes for a modern IDE, these days.
Whatever…
I think that your best bet is simply trial and error: since you appear to know how to use Vim you'll have a lot of commands and shortcuts to try.
I have just made the switch from Textmate to MacVim and so far I am loving it! My workflow is just becoming a breeze… and I'm kinda hooked on that.
As front-end developer working on Rails projects I find that I am constantly opening up the same folders in the projects (app/assets/javascripts|stylesheets & app/views & specs).
I was wondering if there was a way to set shortcuts to open up these folders in NerdTree? I've looked into Bookmarks but these seem absolute paths - I'd like default relative paths for all the Rails projects I work on. Is this possible?
Thanks,
Ad
There is no default way to do this in NERDTree. It is probably possible, but it would require a custom script to do what you're describing. I'm sure you can get help developing that if you look for it, but I'm betting it will be hard to find something that already does this.
You can, however, check out https://github.com/tpope/vim-rails/, which as far as I know is the de facto standard for Rails development in Vim. It'll probably cut down on your need to use NERDTree to navigate files at all, because you can jump through related files quickly with other commands.
As romaini mentioned, bookmarks are also very handy. Make a bookmark for the top-level of a Rails project, open something, use vim-rails techniques to navigate related files, you'll get what you need.
Did you try the project plugin?
NERDTree stores bookmarks in a very simple file. Creating one such file for every project and pointing NERDtree to it may solve the problem.
For folks who have used the Espresso editor, I'll love the right bar for showing the file hierarchy based on the tag nesting and open close. Is it possible in Vim?
I thought taglist was promising, but it's just too smart, it collects and categorize the class and method, but for me who want to know the file hierarchy to know the file structure need the basic feature like Espresso has.
Can taglist be used for this purpose?
Try this: Tagbar
Anyway "Groups tags according to the scope and display them" is in the Taglist plugin's todo :D.
This might be something off topic but I prefer Outline Unite plugin for this kind of functionality because it's integrated with Unite, so you can jump to the function you want by typing their name, and you don't have to keep the outline windows open all the time.
Try NERDTree. I don't know if you can integrate it with taglist, but it'll let you browse the file hierarchy. You can get it at vim.org or on github. Then you can open it with :NERDTree. An even better way to open it is to create a mapping like this
map <leader>t :NERDTreeToggle
Which, for me, toggles it with ,t, so you can keep it out of the way when you don't need it.
I've looked at a number of the IDE style file explorer / management plugins for VIM. The most popular one seems to be Project, but I've never got on well with it. Specifically, having to always create a .project file for the files you want to browse, and that changes to that file hierarchy outside of VIM are not picked up.
I stumbled across the VTreeExplorer plugin and I really like the way it works. I'm trying to work out how I can make it work in a more IDE style way, for instance, to always open vertically down the full length of my window, and once I've opened a file from it, it automatically hides the VTreeExplorer buffer again? Also, ideally it wouldn't show up when I use :bn or a buffer explorer to tab through each file buffer.
Any recommendations would be appreciated. Thanks!
What about NERDTree? It is really good, one of the best file tree plugin for vim available.