开发者

How to turn off auto-insert when selecting text with gVim?

Hello I'm a bit new still to gVim and have a vi and ViEmu(Visual Studio) background. One thing that constantly bugs me if that when I select text with the mouse it will enter SELECT mode. However, I can't do anything from there because whenever I press any key it will replace what I have selected with the key and automatically switch to INSERT mode. How do I keep this from happening 开发者_StackOverflow中文版and keep it in SELECT mode or at least COMMAND mode?


It looks like you ware using gvim on windows, and that you haven't deleted mswin.vim. This file is the root of many evils. My advice: get rid of it and learn vim's way of copy/pasting.

EDIT: you may also need the behave xterm as Benoit suggested. I don't remember if it is really required (all I can say is that my _vimrc has it)


Use:

:behave xterm

and put that to your vimrc.

EDIT : better follow Luc Hermitte's answer.


But the most direct answer is to set selectmode to the desired value.

:set selectmode&

The selectmode is set by the behave command (so yes, removing behave mswin or source mswin.vim and the likes does help).

Look at :he behave to see which values are used for xterm/mswin modes


Documentation :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.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜