且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Windows 8上禁用Vim在Cygwin中的“vi compatible”模式?

更新时间:2022-12-24 10:49:19

使用以下内容创建一个〜/ .vimrc 文件nocompatible模式(实际上只有文件的存在就足够了。)

Create a ~/.vimrc file with the following contents to put vim in nocompatible mode (actually the mere presence of the file is sufficient.)

set nocompatible

你看到的行为是 vi 的行为。这些不是错误。

The behavior you are seeing is how vi used to behave. These are not bugs.

查看:h nocompatible

在vim兼容模式下尝试尽可能地模拟vi。

In vim compatible mode tries to emulate vi as closely as possible.


  1. - insert - 不是vi的一部分,因此不会在兼容模式下显示。

  2. 我相信vi做了一个延迟重绘的屏幕,并没有更新,直到你退出回到正常模式。此外,backspace只能用于在当前插入模式下输入的内容。总体来说,它不是非常用户友好。

  3. 箭头键作为转义序列发送到vim(转义后跟一个字母)。让 ^ [转义。 ^ [OA 在我的电脑上,它可能是类似的你的。 vim将此视为一个转义(返回正常模式),O(在当前行上面添加一行)和A,它是您在屏幕上看到的A.这只是意味着vim在兼容模式下不能正确解释转义字符。很可能是因为vi没有解释它们(也不是为了使用它们)。

  1. --insert-- is not part of vi so it not shown in compatible mode.
  2. I believe vi did a lazy redraw of the screen and didn't update until you exited back to normal mode. Also backspace is only usable also only works on stuff that was entered in the current insert mode. Overall its not very user friendly.
  3. The arrow keys are sent to vim as escape sequences (escape followed by a coupled of letters). Let ^[ be escape. ^[OA is up on my computer its probably something similar on yours. vim sees this as an escape (goes back to normal mode), and O (add a line above the current) and A which is the A you see entered onto your screen. This just means that vim in compatible mode does not interpret the escape characters properly. Most likely because vi did not interpret them (nor was it designed to use them).






set nocompatible 修复问题1和3。

我认为 set backspace = indent ,eol,start 应修复问题2。