I've been accidentally pasting lately, would like to remove this functionality. Bonus points if I can re-assign the input to another function.

Mac OS 10.6.6, MacVim 7.3

link|improve this question

73% accept rate
Does MacVim use X11? If so then the middle click pasting has nothing to do with MacVim, and is a feature of X11. – Zoredache Jan 28 '11 at 8:27
@Zoredache: That is not correct. Even under X11 an application has to explicitly request the contents of the selection from the server on a middle click event; X11 does not do this for applications automatically or arbitrarily. The confusion about this may stem from the problem of running Vim under a terminal emulator such as xterm, which will often be handling mouse events without Vim being aware of it. But Vim can be told to ask xterm (and variants) to pass mouse events through to Vim rather than handle them directly. For more information, see ":help mouse-using". – Heptite Feb 7 '11 at 22:04
feedback

1 Answer

up vote 4 down vote accepted

Middle mouse pasting can be disabled in MacVim with the following configuration:

nnoremap <MiddleMouse> <Nop>
nnoremap <2-MiddleMouse> <Nop>
nnoremap <3-MiddleMouse> <Nop>
nnoremap <4-MiddleMouse> <Nop>

inoremap <MiddleMouse> <Nop>
inoremap <2-MiddleMouse> <Nop>
inoremap <3-MiddleMouse> <Nop>
inoremap <4-MiddleMouse> <Nop>

These will remove all middle-mouse button functionality (Change the <Nop>'s if you actually want the middle button to do something).

link|improve this answer
worked like a charm, thanks Anthony – Ross Charette Feb 9 '11 at 21:13
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.