I\'ve installed the latest vim using homebrew and also installed mac-vim from the google code homepage. in mac-vim everything works fine. but when I run vim in terminal.app in m
I've run into this problem as well. It has multiple causes, but one of them is vim using vi rather than vim behavior by default. Surprisingly, this can be triggered by the location of your vimrc file.
For example, if you delete your .vimrc from your home directory and move the contents to the system-wide vimrc file, vim will start using vi defaults. With the Mac Terminal, this will give you ABCD from arrows in insert mode. Add "set nocompatible" to the system-wide vimrc, which will force vim to use vim defaults, and the arrows will work again.
This works for me:
map ^[[A <up>
map ^[[B <down>
map ^[[C <right>
map ^[[D <left>
To type the sequence for each arrow key, you need to press ctrl-v, then the arrow key.
For example, to type the first line:
m, a, p, space, ctrl-v, ←, space, <, u, p, >
This also might work:
set t_ku=^[[A
set t_kd=^[[B
set t_kr=^[[C
set t_kl=^[[D
More information is available here.
I'm using iTerm2 with spf13-vim, and have same problem today.
It caused by removing plugin vim-autoclose. This solution fixed it.
Just add following lines into your .vimrc
if &term[:4] == "xterm" || &term[:5] == 'screen' || &term[:3] == 'rxvt'
inoremap <silent> <C-[>OC <RIGHT>
endif
Just create an empty ".vimrc file in the home directory of the remote machine. It started working fine for me.
touch ~/.vimrc
This is what worked for me (based on initial solution from @Phoenix above)
imap ^[OA <ESC>kli
imap ^[OB <ESC>jli
imap ^[OC <ESC>lli
imap ^[OD <ESC>hli
for each
^[
type the sequence press ctrl-v, then ESC
You need to set no compatible mode in the vim Try following command in normal mode
:set nocompatible