开发者

edit gvim mouse buttons

I have a two part question regarding mouse clicks on gvim.

1.) I would like to change my gvim double left mouse click into something simil开发者_StackOverflow中文版ar to the windows environment (ie Notepad, Microsoft Word), wherein it: highlights the current word, and replaces it with whatever I type. This is akin to pressing 'cw' for changeword in vim.

2.) I would like my single mouse click to place a cursor upon the selected text and enter insert mode. Again like how a mouse normally behaves in Windows.


1) nmap <2-LeftMouse> ciw

You could use viw here, which will visually select the current word, but then you will still have to press c to replace it.

2) nmap <LeftMouse> <Leftmouse>i

Or replace the i with an a if you would prefer to append, rather than insert.


You can use behave mswin or so $VIMRUNTIME/mswin.vim so set up a lot of stuff so that it works more like a regular windows program.

The specific setting you are looking for are:

set select=mouse

this causes the mouse to start select mode instead of visual mode. Select mode causes the selection to be deleted and insert mode to be entered when a printable key is pressed.

As in Prince Goulash's answer

nmap <LeftMouse> <LeftMouse>i

will turn on a sort of click-to-type mode.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜