How to enable the vim arrow keys in insert mode on a Mac?

70 views Asked by At

After working with vim in environments other than Mac I find myself missing the ability to use the arrow keys while in insert mode to navigate around. I know what I have to change is in ~/.vimrc but I don't know the syntax for it:

inoremap  <Up>     <NOP>
inoremap  <Down>   <NOP>
inoremap  <Left>   <NOP>
inoremap  <Right>  <NOP>
noremap   <Up>     <NOP>
noremap   <Down>   <NOP>
noremap   <Left>   <NOP>
noremap   <Right>  <NOP>

I know the keys are ^[[A, ^[[B, ^[[C, and ^[[D for Up, Down, Left, and Right respectively. Would the syntax just be imap <Down> <^[[B>? I'm a little sketched to change it before I know for sure because I don't want vim to be screwed up.

1

There are 1 answers

0
romainl On

The arrow keys work out of the box so you don't have to change anything to the default setup.

If you are considering adding those lines or variations of them to your vimrc, then you can stop right now as the original form is utterly pointless and the way you are trying to change them is useless.

If you already have mindlessly copied them from somewhere or they are part of someone else's config you took for your own, then remove them as they are probably the reason why your arrow keys don't work.