Wednesday, 4 April 2012

Vim Wizardry Abounds

I've been trying to furtle around with Vim on and off since attending JP Boodhoo's .net bootcamp last year and liking the way he was using Vim and Viemu in Visual Studio. I finally made my first change to a vimrc file and am now overflowing with pride :)

JP mentioned that he had caps lock remapped to escape to simplify switching back to normal mode which seemed like a decent plan, but required an autohotkey script iirc. Googling around the concept of remapping escape in Vim lead me to this page full of ideas. I believe that I'm not the only person trying to use Vim to notice something like jjjjjjj appear in the document I have open, so when I saw the idea to map jj to escape with a simple command I thought I should give it a try. As a quick test I entered the following in a Vim session

:imap jj <Esc>

And lo a double tap on j took me back to normal mode. I enjoyed this so much that I felt it needed to be a permanent fixture, hence my first steps into configuring Vim for me. The page notes that it can be a good idea to use inoremap rather than imap and also hints that tweaking the timeout might be a good idea. I was able to be pretty slow with typing j and still have it launch out of insert mode, so swinging this down a little may improve responsiveness.

No comments:

Post a Comment