Last Updated: February 25, 2016
· hobnob

Making arrow keys work in vim

If your arrow keys are leaving odd characters lying around, rather than moving the cursor you can run this from inside vi or vim:

:set nocompatible

Or you can add this to ~/.vimrc:

set nocompatible

2 Responses
Add your response

Just throwing this out there, using your arrow keys for movement in vim is a pretty big, if not the biggest, antipattern for vim usage. Practicing by removing them is a good way to get yourself off the habit. There is almost always a better way to move around than a single character motion

no <down> <Nop>
no <left> <Nop>
no <right> <Nop>
no <up> <Nop>
ino <down> <Nop>
ino <left> <Nop>
ino <right> <Nop>
ino <up> <Nop>
vno <down> <Nop>
vno <left> <Nop>
vno <right> <Nop>
vno <up> <Nop>
over 1 year ago ·

Never knew that.. cheers for sharing :)

over 1 year ago ·