Why I Enjoy Using Vim

I really love using vim. It's not necessarily because it's much faster for me -- the main reason I enjoy it is the precision. After achieving some comfort with the basic keystrokes and commands, it becomes possible to articulate your way around the document with an incredible amount of precision.

I've been an advocate of keyboard shortcuts for most programs I've used. But vim is a whole new level entirely.

As i understand it, vim's precision has to do with its history: it was developed in a context where internet connections were generally much slower and less reliable. In order to remain productive while editing a remote document over a slow connection, the creators invented methods of navigating and manipulating a document with the goal of minimizing the productivity-detriment experienced by the slow speeds. The result is a set of incredibly powerful commands, which, as you manage to climb up the learning curve, become not only second-nature but increasingly expressive.

I've been fascinated with vim since my introduction to unix, but only recently have I reached a level of familiarity where editing text is a pure joy.

Here's my latest find:

:%norm

The % just says 'do this for every line,' just like when you search every line with %s

The 'norm' says 'execute the following commands.'

So then, whatever follows will be executed on each line. I had a list of OpenGL vertices that I wanted to put in braces, which I accomplished with the following two commands:

:%norm I{

:%norm A}

...to insert a bracket at the beginning and end of each line.

posted on 09/06/2012

tags: vim

Comments:

rss

blog powered by Pelican