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?
我的箭头键在vi的插入模式下在家里不能工作,它们只是插入一个换行符和一个大写字母,比如a。有办法解决这个问题吗?
11 个解决方案
#1
96
I presume you're using vim as this is tagged as Linux. Try:
我猜您正在使用vim,因为它被标记为Linux。试一试:
: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.)
(您可以通过向.vimrc中添加这个命令来配置它。创建一个新的.vimrc文件如果在主目录中还没有出现,运行echo $ home来检查主目录路径。
#2
67
Ubuntu ships default with vim-tiny
, which doesn't have all the bells and whistles that vim has.
Ubuntu默认使用vim-tiny,它没有vim的所有功能。
Do a quick sudo apt-get install vim
to get all the juicy features that everyone's talking about.
做一个快速的sudo apt-get install vim来获得所有大家都在谈论的有趣特性。
#3
29
:set term=builtin_ansi
= 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 ":"
给我固定它。您可以在转义模式(bleep模式)中将其粘贴到vim中,也可以将其添加到~/的末尾。无领导的vimrc ":"
#4
16
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.
vi不支持插入模式中的箭头键。使用vim。虽然您的vi可能只是一个到vim的链接,但它可能被配置为行为类似于“原始”vi,因此禁用箭头键。直接调用vim。
#5
8
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:
另一个变化是:这个问题在一些。vimrc改变后出现了。经过协调一致的搜索,我在正常模式下巧妙地重新映射ESC并不是一个好主意。移除它解决了问题:
" 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
#6
4
The only thing that worked for me was ":set term=ansi"
唯一对我有用的是:set term=ansi
#7
1
I just had an issue with arrow keys after switching over to use git in .vim.
在.vim中切换到git后,我刚刚遇到了箭头键的问题。
I have installed this repo - https://github.com/sunaku/.vim
我已经安装了这个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.
在挖掘了一个小时之后,我发现AutoClose插件(不管怎么说,它不喜欢)打破了箭头键。
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)
插件文档建议应该设置ttimeoutlen=100,但这对我不起作用!(使用urxvt+screen或urxvt,甚至xterm)
So I removed the plugin at the end.
所以最后我去掉了插件。
#8
1
I had same issue with arrow keys, but when I used did that set nocp or nocompatible then my backspace didn't work correctly
我对箭头键也有同样的问题,但是当我使用了set nocp或nocompatible时,我的backspace就不能正常工作了
for some reason when I installed vim with sudo apt-get install vim
, vi didn't had any issues with arrows or backspace anymore
由于某些原因,当我用sudo apt-get install vim安装vim时,vi不再对箭头或回退空间有任何问题
#9
0
You might also want to try 'noesckeys'
你可能也想试试'noesckeys'
#10
0
I had the same issue while using vim inside Windows 8.1 with Cygwin.
我在Windows 8.1和Cygwin中使用vim时也遇到了同样的问题。
Solution worked for me is, just run the following command in your Cygwin terminal:
我的解决方案是,在Cygwin终端运行以下命令:
cp vimrc_example.vim ~/.vimrc
#11
-1
In the command line write this:
在命令行中这样写:
EXINIT="set nocompatible"; export EXINIT
#1
96
I presume you're using vim as this is tagged as Linux. Try:
我猜您正在使用vim,因为它被标记为Linux。试一试:
: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.)
(您可以通过向.vimrc中添加这个命令来配置它。创建一个新的.vimrc文件如果在主目录中还没有出现,运行echo $ home来检查主目录路径。
#2
67
Ubuntu ships default with vim-tiny
, which doesn't have all the bells and whistles that vim has.
Ubuntu默认使用vim-tiny,它没有vim的所有功能。
Do a quick sudo apt-get install vim
to get all the juicy features that everyone's talking about.
做一个快速的sudo apt-get install vim来获得所有大家都在谈论的有趣特性。
#3
29
:set term=builtin_ansi
= 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 ":"
给我固定它。您可以在转义模式(bleep模式)中将其粘贴到vim中,也可以将其添加到~/的末尾。无领导的vimrc ":"
#4
16
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.
vi不支持插入模式中的箭头键。使用vim。虽然您的vi可能只是一个到vim的链接,但它可能被配置为行为类似于“原始”vi,因此禁用箭头键。直接调用vim。
#5
8
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:
另一个变化是:这个问题在一些。vimrc改变后出现了。经过协调一致的搜索,我在正常模式下巧妙地重新映射ESC并不是一个好主意。移除它解决了问题:
" 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
#6
4
The only thing that worked for me was ":set term=ansi"
唯一对我有用的是:set term=ansi
#7
1
I just had an issue with arrow keys after switching over to use git in .vim.
在.vim中切换到git后,我刚刚遇到了箭头键的问题。
I have installed this repo - https://github.com/sunaku/.vim
我已经安装了这个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.
在挖掘了一个小时之后,我发现AutoClose插件(不管怎么说,它不喜欢)打破了箭头键。
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)
插件文档建议应该设置ttimeoutlen=100,但这对我不起作用!(使用urxvt+screen或urxvt,甚至xterm)
So I removed the plugin at the end.
所以最后我去掉了插件。
#8
1
I had same issue with arrow keys, but when I used did that set nocp or nocompatible then my backspace didn't work correctly
我对箭头键也有同样的问题,但是当我使用了set nocp或nocompatible时,我的backspace就不能正常工作了
for some reason when I installed vim with sudo apt-get install vim
, vi didn't had any issues with arrows or backspace anymore
由于某些原因,当我用sudo apt-get install vim安装vim时,vi不再对箭头或回退空间有任何问题
#9
0
You might also want to try 'noesckeys'
你可能也想试试'noesckeys'
#10
0
I had the same issue while using vim inside Windows 8.1 with Cygwin.
我在Windows 8.1和Cygwin中使用vim时也遇到了同样的问题。
Solution worked for me is, just run the following command in your Cygwin terminal:
我的解决方案是,在Cygwin终端运行以下命令:
cp vimrc_example.vim ~/.vimrc
#11
-1
In the command line write this:
在命令行中这样写:
EXINIT="set nocompatible"; export EXINIT