In normal mode of the Vim, I'm expecting middle-click to send the selection text as Vim's command but Vim automatically insert the text to the buffer. How can I avoid this behavior?

For example, selection buffer of the X window contains a Vim's command :1,$s/ \+$// (removing all spaces at the end of line). When I click middle-button on the terminal, Vim does not handle it as a command but insert to the buffer.


  • Assuming that vim itself doesn't handle mouse events in your configuration, and that shift+insert behaves for you just like middle-click, this will be related to "bracketed paste mode". That's how vim knows that the data is coming from a paste operation, rather than being quickly typed. Check vim's documentation for how to turn off (more precisely: how not to turn on) bracketed paste mode. (I don't know the answer to this, sorry, but I hope I could give a useful pointer.)
    – egmont
    Aug 15 '18 at 8:16
  • Thank you, egmont, for letting me know its feature name. As a workaround, I can disable the feature by setting TERM=screen: env TERM=screen vim ... I wish there is a setting for vimrc.
    – kamae
    Aug 17 '18 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.