I have just installed Ctags (to help with C++ development) with my Vim (or rather gVim), and would like to find out your favorite commands, macros, shortcuts, tips that go along with it...
Share your best arsenal. What other Vim add-ons you would recommend for C++ on Vim development?
EDIT What other add-on you would use in conjunction with Ctags?
EDIT2 What version of gVim you use with tags? Does it make a difference?
EDIT3 How do you enhance your programming experience for both big and small projects?
I've encapsulated tags manipulation in an experimental plugin of mine.
Regarding C++ development in vim, I've already answered there: I use my own suite, and a few other plugins.
Ctrl+] - go to definition
Ctrl+T - Jump back from the definition.
Ctrl+W Ctrl+] - Open the definition in a horizontal split
Add these lines in vimrc
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
map <A-]> :vsp <CR>:exec("tag ".expand("<cword>"))<CR>
Ctrl+\ - Open the definition in a new tab
Alt+] - Open the definition in a vertical split
After the tags are generated. You can use the following keys to tag into and tag out of functions:
Ctrl+
Left MouseClick
- Go to definitionCtrl+
Right MouseClick
- Jump back from definitionAll of the above and...
code_complete : function parameter complete, code snippets, and much more.
taglist.vim : Source code browser (supports C/C++, java, perl, python, tcl, sql, php, etc)
One line that always goes in my .vimrc:
This will look in the current directory for "tags", and work up the tree towards root until one is found. IOW, you can be anywhere in your source tree instead of just the root of it.
I put the following in my .gvimrc file, which searches up the tree from any point for a tags file when gvim starts:
I then periodically regenerate a tags file at the top of my source tree with a script that looks like:
You can add directories to your ctags lookup. For example, I have a ctags index built for Qt4, and have this in my .vimrc: