Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
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).

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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