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?
babun: copy/paste from windows clipboard into vim?
13.6k views Asked by ihadanny At
5
There are 5 answers
0
On
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:
- In your Windows editor ctrl + c the text or code you want.
- In vim, press Esc (normal mode).
- Type :set paste, then press i. Insert (paste) will appear to indicate you can now paste your text.
- With arrow keys, go to the place you want to paste your text.
- With your mouse click and the text will get pasted.
To get out from Insert(paste) mode:
- Press Esc, then type :set nopaste. Press i and you will be back to normal Insert mode.
Hope this helps!
0
On
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
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 toset 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.