tags:

views:

2101

answers:

5

My arrow keys don't work in vi in insert mode at home, they just each insert a newline and a capital letter, like 'A'. Is there a way to fix that?

+5  A: 

vi does not support arrow keys in insert mode. Use vim. Although your vi may just be a link to vim, it may be configured to behave like the "original" vi and thus disables the arrow keys. Just invoke vim directly.

lothar
+7  A: 

I presume you're using vim as this is tagged as Linux. Try:

:set nocompatible

(you may want to configure your .vimrc with this)

Brian Agnew
Make sure you start vi with the command `vim` and not `vi`. Most of the advanced and useful features of `vim` are disabled by default unless you start it with `vim`.
pts
@pts - only on broken systems. Starting vim as vi on all of my boxes works just fine; however, there are some CentOS boxes I have used that demonstrate the behavior you are talking about.
Chas. Owens
A: 

Ubuntu ships default with vim-tiny, which doesn't have all the bells and whistles that vim has.

Do a quick sudo apt-get install vim to get all the juicy features that everyone's talking about.

Han
A: 

You might also want to try 'noesckeys'

goner
A: 

:set nocompatible worked for me on Linux! Thanks.

syam