Vim is an excellent general-purpose text editor, but it is relatively stupid by itself in some situations. Thankfully, it can be scripted. You can find many scripts on www.vim.org/scripts, I will mention a few useful ones here.
Every decent code editor has a shortcut to quickly comment / uncomment a block of code. A similar effect can be achieved on Vim by installing FeralToggleCommentify. This plugin works with a great number of different filetypes. I especially like to use it to comment out HTML/XML markup because XML comment tags are tedious to type (the script comments each line of the selection separately though). The binding C-c, although on a nasty key, is quite useful as well - it makes a copy of the current line and comments it out.
If you work with Subversion and write commit messages with Vim, you might find svn-diff handy (you will need Python scripting support in vim). It shows the diff of your commit in a pane below the commit message. Besides, Vim does syntax highlighting, so the patch is easier to read than on the console. Remember that if you see something wrong in the diff, you can always abort the commit by not saving the commit message file or, if you have already saved it, deleting the file (
Python coders will appreciate the smart handling of indentation by the alternative python indent script. It is sometimes too smart and therefore annoying, but works well in most cases.
The XML editing plugin is also nice to have if you deal a lot with HTML / XML. Its functions appear to be quite useful (I keep forgetting the bindings): jumping between opening and closing tags, enclosing content in tags and deleting enclosing tags, etc.
If you work in Vim a lot, I highly recommend to remap Escape. The standard position makes you move your hand away from the home row. I have remapped Escape to Caps Lock which I never use. It takes a few minutes to readjust to the standard Escape position when working in Vim on other computers, but that is a small price to pay for the increased productivity. You can remap the key on X by using
xmodmap ~/.xmodmaprc after creating the
.xmodmaprc file in your home directory that contains these two lines:
clear lock keycode 66 = Escape
Make sure to have a look at a post by Marius Gedminas about CTags and id-utils if you are not familiar with these two timesavers.
I have uploaded my vimrc, maybe you will find something useful in there. I highly encourage to go through the Vim internal features that are turned on in the script, you will probably want to use most of them. Do not expect the script to work out of the box, you will have to remove the sections that depend on other scripts and plugins.