Getting myself to use j,j,k, and l in vim

15 Jul 2012 - vim

I’ve been using vim for a while now, I guess about 2 years? Heck, I’m even writing this post in vim (yay, jekyll!). After all this, I was using arrow keys for moving around in vim. I thought, they worked for me, until I recently read a blog post about vim One of the suggestions in there was to map the arrow keys to in normal mode and insert mode. I’ve tried it out for a week now, and I wonder, how did I ever use the arrow keys; h, j, k, and l make so much more sense)

If you’ve always wanted to get rid of your arrow key habit, add this to your .vimrc!

nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>

The one place where I used arrows was for vim completion with ^N and ^P. Quickly, I learned that ^N and ^P can replace the arrow keys there too! It’s still not yet muscle memory, but pretty close.