I know vim gurus would criticize me for using arrows in vim's insert mode but it's really hard to give them up.
I have this problem when I connect from my linux box to a MacOSX or FreeBSD box over ssh. I find it one of the most annoying things when using vim. When you are in insert mode and hit one of the arrows to move around, instead of the expected action vim will just print A, B, C or D on a new line. This makes vim practically useless.
So either you are very careful and always exit the insert mode before you move or fix the keys.
I think it's hard to always remember to get out of insert mode and it's one extra operation you have to do that I find useless not to mention you will probably have to enter insert again a few seconds after that.
So here's the fix for the arrow keys. Edit vimrc either the global vimrc ( I'm using vim from macports so my vimrc is /opt/local/share/vim/vimrc ) or ~/.vimrc like this:
$ vim ~/.vimrc set t_ku= (now type Ctrl-V and press cursor up) set t_kd= (now type Ctrl-V and press cursor down) set t_kr= (now type Ctrl-V and press cursor right) set t_kl= (now type Ctrl-V and press cursor left)
This solution was stolen from vim tips wiki. I posted it here to avoid looking for it again if I need it. It's the second time I am hit by this problem and every time I had to search through a few pages with solutions that didn't work for me
you set the right key twice.
Thanks, I fixed it