8

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

2 Answers 2

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.

4
  • 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. Feb 21, 2014 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, 2014 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? Feb 23, 2014 at 7:47
  • 1
    Edited, hopefully it's not confusing.
    – Heptite
    Feb 23, 2014 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.

2
  • 4
    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. Apr 2, 2016 at 22:55
  • 2
    -1 for remove all settings in .vimrc.
    – dhaupin
    Oct 21, 2016 at 19:20

You must log in to answer this question.

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