Linux vi arrow keys broken in insert mode

2019-01-08 04:41发布

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?

标签: linux vim vi
11条回答
霸刀☆藐视天下
2楼-- · 2019-01-08 05:13

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.)

查看更多
迷人小祖宗
3楼-- · 2019-01-08 05:13

Yet another variation: this problem appeared for me after some .vimrc changes. A concerted search eventually revealed that my clever re-mapping of ESC in normal mode was not a good idea. Removing it solved the problem:

" this is NOT something you want in .vimrc:
" In normal mode, hitting Esc turns off search highlights:
nmap <ESC> :nohl<CR>  " Do NOT add this to .vimrc
查看更多
Root(大扎)
4楼-- · 2019-01-08 05:15

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.

查看更多
smile是对你的礼貌
5楼-- · 2019-01-08 05:15

I had same issue with arrow keys, but when I used did that set nocp or nocompatible then my backspace didn't work correctly

for some reason when I installed vim with sudo apt-get install vim, vi didn't had any issues with arrows or backspace anymore

查看更多
爷、活的狠高调
6楼-- · 2019-01-08 05:19

:set term=builtin_ansi

fixed it for me. You can either paste that into vim while in escape mode, (bleep mode) or add it to the end of ~/.vimrc without the leading ":"

查看更多
女痞
7楼-- · 2019-01-08 05:23

The only thing that worked for me was ":set term=ansi"

查看更多
登录 后发表回答