What are the best general purpose programming tools to complement Vim?
A great feature of vim is the ease of integration with existing shell commands. Some of the most useful external tools are the ones that are included in coreutils and other simple text maniplulation tools. For example, we can get the number of lines in a file with:
:! wc -l %
or the number of words:
:! wc -w %
Any command that works on the shell will work here. This can be powerfully combined with the :read
(:r
) command to put the output of the command into the file. For example:
:r !wc -l %
Will place the word line count into the file you are editing.
Another advantage of this is replacing the text you are currently editing with the output of one of these commands. For example, you could format the entire file with par
by executing the command:
:% !par
I find NERDtree indispensible for navigating through my codebase. Alongside that, investing some time in becoming proficient in moving around your buffers/windows is really worthwhile.
Whatever your language you'll want to use a feature called ctags that lets to browse around source definitions. This requires an external tool to generate TAGS files that are used by VIM to discover the locations of various code definitions within a project.
Get the exuberant ctags tool, it works for many many languages and is v simple to use.
from VIM :help ctags
ctags will create an index of all identifiers in a source tree. You can then use the tag commands to navigate around your source tree. see :help tag-commands
. The easiest is to place the cursor over a keyword and press CTRL-]. To get back to where you came from press CTRL-T
Beyond this you might want to look at some of the VIM tips and improvements discussed here, it's a very comprehensive discussion of some of the things than can be done to improve a vimmer's experience.