简体   繁体   English

Vim中的退格行为

[英]Backspace behaviour in Vim

I've got a problem with backspaces in Vim. 我在Vim中的退格键有问题。 If I hit backspace, the last character gets removed. 如果我按退格键,最后一个字符将被删除。 I'd like to get the Vi (not Vim) behaviour. 我想了解Vi(不是Vim)的行为。 In Vi backspace moves the cursor to the left, and if I type in something, the characters I backspaced get replaced. 在Vi退格键中,将光标向左移动,如果我键入一些内容,则退格的字符将被替换。

I tried 我试过了

:imap <BS> <Left>

It works in GVim (even if the backspaced chars don't get replaced), but it does not work in Vim. 它可以在GVim中工作(即使不替换退格字符),但是在Vim中也不能工作。 If this helps, I use the standard XTerm as my terminal emulator, and my $TERM environment variable is set to 'xterm'. 如果有帮助,我将标准XTerm用作终端仿真器,并将$ TERM环境变量设置为“ xterm”。

I believe you want Replace instead of Insert mode. 我相信您要替换而不是插入模式。 Hitting the 'insert' key once will put you into Insert mode but hitting it twice will put you into Replace mode. 一次单击“插入”键将使您进入“插入”模式,但两次单击将使您进入“替换”模式。 That should give you the expected behaviour. 那应该给您预期的行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM