Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux vi arrow keys broken in insert mode

Tags:

linux

vim

vi

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?

like image 968
josh Avatar asked May 01 '09 19:05

josh


People also ask

Can't use arrow keys in vim?

To fix not working arrows in the insert mode permanently, add set nocompatible command to vi / vim configuration file in your $HOME directory.

How do I get out of insert mode in vi?

To come out of the insert mode, press the Esc key, which will take you back to the command mode.

Why do the vi vim Editors use H J K and L to support cursor movement in addition to arrow keys?

Because vim is exempt from keeping up with technological advances :3. You can put four fingers of one hand on the hjkl keys, comfortably, and move the cursor all four directions without shifting fingers back and forth.


1 Answers

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

:set nocompatible 

(You may want to configure your .vimrc with this by adding this command to it. Create a new .vimrc file if not already present in your home directory, run echo $HOME to check home directory path.)

like image 51
Brian Agnew Avatar answered Sep 20 '22 14:09

Brian Agnew