Thursday 9 August 2007

Making the most of vim: vimproject saves typing

If Java sources are arranged in a hierarchy of directories which reflects their package names, they can end up quite deep down. Opening a different file from vim can mean a lot of typing. I first wrote vimproject in 2001 to get around this. I didn't want an IDE --- real men don't use those. I just wanted something to allow me to open files without a load of typing.

The solution is a small Python script and the vim-python package available on some Linux distributions (Ubuntu, for example). By adding a few lines to ~/.gvimrc and writing a simple XML file, you can get vim to add a menu which allows you to open files quickly, with no typing and without resorting to a huge, slow IDE. Full instructions are on the vimproject page.

vimproject works with vim in GUI mode -- it needs the GUI's menu bar, so it won't work with the non-GUI version. It could probably be done in vim's built-in language, but I don't know that and don't have the time or the inclination to learn it.

No comments: