Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim: change mouse click behavior

Tags:

I am playing with my vimrc settings, and enabled the mouse support.

set mouse=a 

Now, I miss the copy and paste option with mouse. Normally, if the mouse is not enabled, I could copy text with left click + drag, and paste by right click (in Insert mode). So,

How to get the copy, paste with mouse enabled (with mouse click, not Ctrl+v etc). The only option I need with mouse enabled is to click anywhere in the file and the cursor points to that location. This helps faster navigation.

I use putty (x-term) to connect to my debian server.

like image 660
bsr Avatar asked Feb 06 '11 02:02

bsr


People also ask

How do I make my mouse work in vim?

In general, mouse reporting is not enabled in apps by default. For example, to enable mouse reporting in Vim, you need to add a set mouse=a command to your ~/. vimrc file. In the Terminal app on your Mac, choose View > Allow Mouse Reporting.

What is set mouse A?

If you want ":set mouse=a" to work over SSH, just use the '-X' option when using SSH. If using vim in xterm and having set mouse=a, you will notice mouse middle-click paste no longer seems to work. Instead use Shift+middle-click to paste X selection.

How to copy text from vim with mouse?

With that mentioned mapping, \c will do "+y which will copy from the register known as +, to the clipboard. And \v will paste from the register known as +. So that's a copy/paste that works between windows.


1 Answers

Easiest solution is just to hold shift down when you select text, to get the old behavior for mouse-copy. Paste with shift-mouseclick will usually work too.

like image 195
jkerian Avatar answered Oct 05 '22 21:10

jkerian