Linux vi arrow keys broken in insert mode

后端 未结 11 795
[愿得一人]
[愿得一人] 2020-12-02 06:18

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?

相关标签:
11条回答
  • 2020-12-02 06:25

    :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 ":"

    0 讨论(0)
  • 2020-12-02 06:25

    vi does not support arrow keys in insert mode. Use vim. Although your vi may just be a link to vim, it may be configured to behave like the "original" vi and thus disables the arrow keys. Just invoke vim directly.

    0 讨论(0)
  • 2020-12-02 06:28

    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

    0 讨论(0)
  • 2020-12-02 06:38

    You might also want to try 'noesckeys'

    0 讨论(0)
  • 2020-12-02 06:39

    I just had an issue with arrow keys after switching over to use git in .vim.

    I have installed this repo - https://github.com/sunaku/.vim

    and after digging around for an hour, I found that AutoClose plugin (which didn't like anyway) broke the arrow keys.

    The plugin docs suggest that one should set set ttimeoutlen=100, but that didn't work for me! (using urxvt+screen or urxvt, and even xterm)

    So I removed the plugin at the end.

    0 讨论(0)
  • 2020-12-02 06:41

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

    0 讨论(0)
提交回复
热议问题