Vim Tips Wiki
Register
(Adding categories)
(Adjust previous/next navigation)
Line 9: Line 9:
 
|version=6.0
 
|version=6.0
 
|rating=5/2
 
|rating=5/2
|category1=
+
|category1=Mouse
 
|category2=
 
|category2=
 
}}
 
}}
Line 40: Line 40:
   
 
----
 
----
[[Category:Mouse]]
 

Revision as of 02:45, 20 July 2009

Tip 843 Printable Monobook Previous Next

created January 5, 2005 · complexity basic · author charles · version 6.0


After some time using mini buffer explorer script#159, here is the way for moving between buffers using the mouse (thus gvim only) and minibufexpl I feel comfortable with.

1. Download the minibufexpl script and put it in the plugin directory (~/.vim/plugin or %HOME%\vimfiles\plugin in windows). Thus we have a pseudo tabbar in GVim window.

2. Map the right click to <Esc> by adding these lines to vimrc

imap <RightMouse> <Esc>
nmap <RightMouse> <Esc>

3. Then when we want to switch buffer in insert mode (or normal mode), instead having to press the <Esc> key, then move the mouse and click the buffer name, we instead just need to right click and click the buffer name using the mouse. Quite easier I think.

Drawback, you lose your right click menu.

Comments

That's a great idea, but try this:

imap <RightMouse> <Esc>
nmap <RightMouse> i<LeftMouse>

As before, right mouse gets you out of insert mode, so you can quickly use the mini buffer explorer. In normal mode, right mouse will put you in insert mode wherever you click.

Now, to edit a different file, <RightClick> to exit insert mode, double <LeftClick> on the new filename, navigate to where you want to edit and <RightClick> to begin insert mode.