Friday, January 05, 2007

Automatic formatting.

For me it is rare that I use VIM to compose text messages. This is unfortunately due to the nature of writing in VIM: it isn't embedded in the browser window where I am currently composing this blog entry, and it isn't in my mail composer (unless I'm using mutt). Its just not the de facto standard for editing no matter how much I sometimes which is was.

Nevertheless, sometimes I do want to compose a message in VIM. When I do, its usually so that I can take advantage of the automatic formatting features in VIM. Here are the typical settings I use to setup a text editing session:

:set tw=80
:set fo=at

This gets me just the basics: when I insert/delete text in VIM, the text is automatically wrapped/unwrapped.

But I really want my numbered lists to be formatted correctly. In that case I add on an extra flag:

:set tw=80
:set ai
:set fo=atn

Of course, in VIM 7 you can add spell check to that:

:set spelllang=en_us
:set spell

Use the the z= command to find alternate spellings underneath your cursor.

No comments: