7

I would like to scroll my files opened in vim using mousewheel, but at the same time using the left mouse button to select text into clipboard.

Setting :set mouse=nicr (or :set mouse=a) will only accomplish the former, doing :set mouse= will only accomplish the latter. There is a similar question - Vim enable mouse scroll only - not cursor positioning - already on SU, but the answer suggests to disable left click functionality altogether, contrary to my needs.

I work with MATE terminal (xterm).

1

Vim should be able to connect to the X server and allow you to highlight text and have it copied into the X selection buffer. Is the letter "a" in your 'guioptions' setting?

:verbose set guioptions?

(Include the question mark as part of the command.)

If Vim says that option is not supported it means you have a lighter version of Vim installed. Check the output of ":version" and if you see a "-" in front of "mouse_xterm" or in front of "x11" you need a different version of Vim.

Most Linux distributions make a few versions of Vim available, but often just install the lighter version by default. Check your package manager's list and find the appropriate package. Look for something like "vim-gtk" or "vim-enhanced".

Alternatively almost all xterm type emulators let you hold down shift to allow the terminal to "take control" of the mouse highlighting instead of sending mouse events to the application running in the terminal.

  • E519: Option not supported: guioptions? - VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 12 2013 00:23:19) I know about the shift option, but copying without shift pressed would be even better. – Radek Liska Feb 21 '14 at 16:23
  • Okay, you need to install a version of Vim that supports X, or just use the shift trick. Most Linux distributions make a few versions of Vim available, but often just install a lighter version by default. Check your package manager's list and find the appropriate package. – Heptite Feb 21 '14 at 19:48
  • Installing vim-gtk and settimg "mouse=a" did exactly what I needed, thanks! Could you slightly expand your answer, so that I can accept it? – Radek Liska Feb 23 '14 at 7:47
  • 1
    Edited, hopefully it's not confusing. – Heptite Feb 23 '14 at 8:31
-6

Easiest way is use mobaxterm, remove all settings in ~/.vimrc

In this way you can do both mouse scroll and copy.

  • 3
    Your suggestion is "Delete all your configuration options." That's terrible advice. Presumably, at least some of those configuration options were useful, or they wouldn't have been set. – David Richerby Apr 2 '16 at 22:55
  • 2
    -1 for remove all settings in .vimrc. – dhaupin Oct 21 '16 at 19:20

Your Answer

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

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