Vim

Vim has been my go-to text editor for about a year. The learning curve was a bit steep, but after the initial awkwardness I felt right at home. It was like learning touch typing. At first it was terribly slow, but I quickly realized the power of this new system and gained speed.

The concept of modal editing was hard to get used to. At first I kept trying to use the movement keys in insert mode or type in normal mode. Like most lifestyle changes it eventually became a habit. Being able to use easily accessible keys to go somewhere else in a file and manipulate the text probably sped up my editing by a factor of three. Emacs-like editing seems more complex. It relies on multiple combinations of keystrokes (Control-X 0 to close a window, etc) to do simple actions. Vim also has this problem in some cases (Escape, :q to close a window), but the commands are much simpler. The commands can be modified or used in long sequences to complete tedious or time consuming tasks in seconds. For example, in normal mode entering d5w deletes the five words after the cursor or d) which deletes a sentence. Vim’s interface is more flexible than other editors.

Vim’s tendency to have oft-used keyboard shortcuts on the home row is also useful. It cuts down on unnecessary hand movement. It takes less time to press dw than it does to move your hand up to the delete key and press it five times. The same concept is what makes the hjkl movement system so powerful. The decreased hand movement combined with vim’s flexible command system makes text editing very easy.

Some of vim’s commands require the use of the control key. I use the autocomplete feature very regularly while programming. Having descriptive function and variable names often makes them longer and harder to type. Combined with my recent switch to using underscores instead of camelCase (I’ve been doing a lot of work with Ruby), having a good autocompletion system is a must. Having to twist my hand every time I wanted to autocomplete something was annoying so I took a page from the book of Emacs and remapped the control key to caps lock. Vim makes good use of escape, another poorly located key. Luckily it’s also mapped to control-[ by default.

I don’t like vim’s way of doing text selection. I do like the whole line selection (shift-v), but in general text selection is difficult. Selecting the entire line is useful when moving a block of code or something, but it’s harder to select words and phrases. This is one part of editing that I liked using Emacs for. I put up with the selection problem for a while and got better at using numbers to run a command more than once (e.g. v3w will select the next three words). I found a solution in the form of gVim. It combines the power of vim and the intermittent efficiency of a GUI. I’ve made some other tweaks to my .vimrc (configuration file) to improve my experience. I now use gVim for almost all of my editing.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s