使用gVim选择文本时如何关闭自动插入?

时间:2011-08-24 16:27:29

标签: vim editor

您好我对gVim还有点新鲜,并且拥有vi和ViEmu(Visual Studio)背景。如果我用鼠标选择文本时它会进入SELECT模式,那么有一件事经常让我感到困惑。但是,我无法从那里做任何事情,因为无论何时按任何键,它都将替换我用键选择的内容并自动切换到INSERT模式。如何防止这种情况发生并将其保持在SELECT模式或至少是COMMAND模式?

3 个答案:

答案 0 :(得分:7)

看起来你在windows上使用gvim,并且你没有删除mswin.vim。这个文件是许多邪恶的根源。我的建议是:摆脱它并学习vim的复制/粘贴方式。

编辑:您可能还需要Benoit建议的behave xterm。我不记得是否真的需要(我只能说我的_vimrc有它)

答案 1 :(得分:2)

使用:

:behave xterm

并将其添加到您的vimrc。

编辑:更好地关注Luc Hermitte的回答。

答案 2 :(得分:1)

但最直接的答案是将selectmode设置为所需的值。

:set selectmode&

selectmodebehave命令设置(是的,删除behave mswinsource mswin.vim并且喜欢这样做。

查看:he behave以查看哪些值用于xterm / mswin模式


文档:he selectmode

  

'selectmode' 'slm' string (default "")

      global
      {not in Vi}
  This is a comma separated list of words, which specifies when to start
Select mode instead of Visual mode, when a selection is started.
Possible values:
   mouse    when using the mouse
   key      when using shifted special keys
   cmd      when using "v", "V" or CTRL-V
See |Select-mode|. 
The 'selectmode' option is set by the |:behave| command.
相关问题