21

right-clicking while at the prompt dumps the contents of the clipboard into the shell, but in vim it just switches to VISUAL mode and does nothing. How do I workaround this?

https://github.com/babun/babun/issues/97

kasi
  • 955
  • 1
  • 12
  • 21
ihadanny
  • 4,377
  • 7
  • 45
  • 76

5 Answers5

30

While in vim, try tu use shift + Mouse right click

kasi
  • 955
  • 1
  • 12
  • 21
15

Running the following command worked for me. Essentially just adding to your vimrc.

echo "set mouse-=a" >> ~/.vimrc
LukeGeneva
  • 584
  • 1
  • 3
  • 15
  • This was driving me nuts! Why people want to use a mouse with VIM I will never understand. When I use my mouse to highlight something to copy, I expect that my vim cursor has NOT moved, I'm still in insert mode, and I am ready to paste. All is now right with the world [again]. – Bruno Bronosky Nov 21 '16 at 21:40
  • Thanks. This really helps – Doogle Dec 24 '16 at 15:09
5

Adding to the various other solutions: if you're getting the --visual-- mode when right-clicking into vim (babun) when trying to paste from the clipboard, you may try to paste by using the following (in "esc" edit mode): "*p

That is: keep holding shift down to type double-quote (") followed by *, then type a lower-case p

michael
  • 9,161
  • 2
  • 52
  • 49
2

There are several variants how to run vim under MS Windows. Let assume you run console vim (not gvim) under cygwin.

The option mouse controls the vim mouse behavior. When you set the option :set mouse= then right click pastes the windows clipboard to vim. When you set the option to set mouse=a vim tries to interpret the mouse click somehow in all modes and it is a switch to visual mode when vim is in normal or insert mode.

See :help mouse for details.

Zaboj Campula
  • 3,155
  • 3
  • 24
  • 42
1

UPDATE: If its just a couple lines, ctrl c whatever you want to paste go to vim editor and just right click with your mouse where your arrow is at; this will paste everything. It is a faster approach, however everything will be paste as a comment.

I had tried other things before, but this is the only way it worked for me.

For Window users and beginners like me:

  1. In your Windows editor ctrl + c the text or code you want.
  2. In vim, press Esc (normal mode).
  3. Type :set paste, then press i. Insert (paste) will appear to indicate you can now paste your text.
  4. With arrow keys, go to the place you want to paste your text.
  5. With your mouse click and the text will get pasted.

To get out from Insert(paste) mode:

  1. Press Esc, then type :set nopaste. Press i and you will be back to normal Insert mode.

Hope this helps!

Robokitty
  • 11
  • 2