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?
-
Can you tell what line are you trying to paste? – Anurag Peshne Jun 17 '15 at 07:12
-
it doesnt matter, just copy anything from another windows window – ihadanny Jun 17 '15 at 10:22
-
It may matter. If the line you are pasting is starting with a 'v' then it may interpret it as a command and enter in visual mode. If so, enter insert mode first and then try pasting. – Anurag Peshne Jun 17 '15 at 10:24
-
What about to select the answer that is working for you? :) – kasi Feb 16 '16 at 07:00
-
@kasi I'm sorry, I'm no longer working with babun so I can't say for sure... Want me to select your answer anyway? – ihadanny Mar 03 '16 at 15:06
-
@ihadanny I can only tell for myself that it works, but i can not tell for you :) – kasi Mar 03 '16 at 17:18
5 Answers
While in vim, try tu use shift + Mouse right click

- 955
- 1
- 12
- 21
-
1This works like charm, but other solution of set mouse=a in .vimrc solved the problem – Doogle Dec 24 '16 at 15:09
Running the following command worked for me. Essentially just adding to your vimrc.
echo "set mouse-=a" >> ~/.vimrc

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

- 9,161
- 2
- 52
- 49
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.

- 3,155
- 3
- 24
- 42
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!

- 11
- 2