Vi/Vim – Arrow Keys Don’t Work – Print Letters in Insert Mode

By default, vi/vim text editor uses the h, j, k and l keys for navigation.

Hitting arrow keys in the insert mode will insert newlines and print A, B, C, D capital letters.

In this small note i will show how to fix not working arrow keys, that print letters in the insert mode in vi/vim.

Fix Not Working Arrow Keys in Vi/Vim

If you are using vi/vim text editor and the arrow keys don’t work and print letters in the insert mode, run the following command to fix this:

:set nocompatible

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

Fix not working arrow keys in vim:

$ echo "set nocompatible" >> ~/.vimrc

Fix not working arrow keys in vim:

$ echo "set nocompatible" >> ~/.exrc