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
Cool Tip: Adjust color scheme to a dark background in vi/vim! Read more →
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
Thanks.
Thank you so much for this.
Thank you! This was driving me crazy
Not sure if this is relevant but I was having issues with the arrow keys printing letters as well then realized I was using vi not vim.
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
This also enables the code formatting colors.
Found this here:
https://stackoverflow.com/questions/812973/linux-vi-arrow-keys-broken-in-insert-mode