Vim Tips Wiki

Moving between buffers using mouse

Revision as of 04:12, May 16, 2012 by JohnBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
1,613pages on
this wiki
Tip 843 Printable Monobook Previous Next

created 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.


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.

Around Wikia's network

Random Wiki