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.

Cool Tip: Fix not working backspace in vi/vim! Read more →

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" >> ~/.exrc

Fix not working arrow keys in vi:

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

2 Replies to “Vi/Vim – Arrow Keys Don’t Work – Print Letters in Insert Mode”

  1. Thanks for the tip:
    Seems like you have a typo, though:
    .exrc is the configuration file for vi, whereas .vimrc is the config file for vim

Leave a Reply