Vim

Perfecting Vim

Published 16 January 2011

Before I started using vim, my main text editor was the e-text editor. Now that I've been using vim for a while, I have no desire to go back to e, but I still miss one feature -- smart indenting on line wrap. When typing in e if my text wrapped around to the next line it would automatically be indented at the level of the previous line. In vim, when a line wraps, it is never indented. You can handle this by putting in hard line breaks, but then if you need to cut and paste your test anywhere you end up reformatting it all the time. I prefer smart indenting that I don't have to mess with.

Here is an example of the vim behavior that irritates me (see line 6):

Vim Screenshot showing a wrapped line that is not indented.

And here is the way I like it to be:

Vim Screenshot showing a wrapped line that is indented.

Luckily I'm not the first person that has wanted this. Václav Šmilauer developed a patch that has been updated by Eli Carter. There is no way to use this in the default vim distribution, but if you build vim from source you can add in this break indent patch.

Read full entry

Vim Cheat Sheet

Published 08 June 2010

Vim tricks and shortcuts I want to remember:

*Search forward for the word under the cursor.
#Search backward for the word under the cursor.
viwpReplace the word under the cursor with the contents of the unnamed clipboard.
g; Move to the position of the last edit.
ctrl-nAutocomplete in insert mode based on the open buffers.
vim -O filename.txt filename2.txtOpen multiple files in vertical split from the command line. Note the small o option opens them horizontally split.

Must-have Plugins

snipMate
SuperTab

Vim Resources

VimCasts
Vim Tricks from StackOverflow
More Vim Tricks from StackOverflow
Sample .vimrc Files from StackOverflow

Copyright 2000-2008 Jason Anderson.

Powered by Django, Photologue and Galleria.