如何在Windows 8上禁用Vim在Cygwin中的“vi compatible”模式? [英] How to disable 'vi compatible' mode for Vim in Cygwin on Windows 8?

查看:198
本文介绍了如何在Windows 8上禁用Vim在Cygwin中的“vi compatible”模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 8(64位)上使用Cygwin 1.7.22(32位)。在Cygwin中,我使用的是Vim 7.3.1152,这是默认版本。

I am using Cygwin 1.7.22 (32-bit) on Windows 8 (64-bit). Within Cygwin, I am using Vim 7.3.1152, which is the default version.

看起来像错误的行为:


  1. 当我按 I 进入插入模式时,不会说 - INSERT - 在左下角。事实上,它没有说什么。

  1. When I press I to enter insert mode, it does not say -- INSERT -- in the bottom left. In fact, it doesn't say anything. It does behave correctly, though.

当在插入模式下使用 Backspace 删除字母时,字母不会消失,

When I delete letters using Backspace in insert mode, the letters do not disappear but the cursor does move to the left.

当在插入模式下使用箭头键时,它会输入字母A,B,C和D,光标。

When I use the arrow keys in insert mode, it enters the letters A, B, C, and D, rather than moving the cursor. The arrow keys work normally outside of insert mode.

如何让Vim按照我的预期行事?

How do I make Vim behave as I expect?

推荐答案

使用以下内容创建一个〜/ .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。

这篇关于如何在Windows 8上禁用Vim在Cygwin中的“vi compatible”模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆