2

I've been accidentally pasting lately in MacVim, and would like to remove this functionality.

How can I disable the middle-click-to-paste action? Bonus points if I can re-assign the input to another function.

I'm running Mac OS 10.6.6 and MacVim 7.3.

2
  • 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, 2011 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, 2011 at 22:04

1 Answer 1

6

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

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .