Even more features!

VIM

I have been using VIM as my primary editor for as long as I can remember. Still, I keep finding new feature making it even more efficient. I actually had enough time today to dig into the documentation. I guess I now have an argument against all those who pretend GUIs are better than VIM simply because it has class navigation.

With folding, VIM offered a great overview of classes already. Today, I found out that there was actually a “go to definition” feature hidden. Using ctags (exuberant-ctags actually), a simple Ctrl-] while over a token such as a function or class name teleports you to the definition. Using Ctrl-W Ctrl-] (as a sequence) will open a split buffer with the destination in it. Once you’re done looking at the actual code, Ctrl-T bring you back exacltly where you were. The process works as a stack: you can navigate multiple definitions and Ctrl-T take you back to the previous until the stack is empty. As always, everything is lightning fast. The search uses a ctags file located in the current directory. The file is generated using your favorite ctags implementation (`exuberant-ctags -R` worked just fine for me).

Exuberant-ctags supports 33 languages (including all those you really need) and is integrated with multiple open source editors out there (including vim, emacs, nedit, …). From what I can understand, it seem to have started as a sub-project of VIM.

As if it was not enough, ‘gf’ over a file name loads it. :find file_name searches for file_name in all known paths (can be changed using :set path). These can be useful, but I still prefer switching files using buffer numbers.

Leave a Reply

Your email address will not be published. Required fields are marked *