No arrows in Vim

Mar 10, 2011

Configure your Vim to disable the arrow keys and learn how to move with the right keys.

I’ve been using Vim a lot lately.

Vim was the first editor I ever used to write code. The first lines of code I wrote were written with Vim. I kept using it several years in college. I dropped it when I started developing in Java.

After a short time with Oracle JDeveloper and several years with Eclipse I’ve returned to my origins.

Since I use (and am in love with) Mac OS X, MacVim is my editor of choice. (Could have used Vim on my terminal I just like MacVim better).

Lately @plagelao has been sharing his Vim configuration. Following his example I want to start sharing mine too.

Since I know a few people that are starting to use Vim I want to share a couple of key remaps that @javisantana suggested to help me with my come back to Vim.

The first thing anyone should get used to when starting to use Vim is moving around with j, k, h and l. It looks easy, but it’s harder than you think.

To avoid using arrows, just disable them!

"Disable arrows
map   <up>    <nop>
map   <down>  <nop>
map   <left>  <nop>
map   <right> <nop>
imap  <up>    <nop>
imap  <down>  <nop>
imap  <left>  <nop>
imap  <right> <nop>

This way you will be forced to use the right keys to move around.