When I copy some lines in the VIM by marking and then right clicking sometimes there are some insert operations that happen and the letter 'p' is added to the file.
How can I copy and paste without this issues?
When I copy some lines in the VIM by marking and then right clicking sometimes there are some insert operations that happen and the letter 'p' is added to the file.
How can I copy and paste without this issues?
When using VIM there a many better approaches to copy text. VIM is ideally used without a mouse.
To copy full lines, you can type 3yy
where you can replace 3 by the amount of lines you want to copy. You can also copy text by range of line numbers :2,5y
. Furthermore, you can select lines by enetering visual mode (press v).
Pasting can be done by typing p
in normal mode. These ways are eventually much faster than approaches including the mouse.
Use the :help clipboard
registers to copy to your system clipboard. Depending on your system it might be "*
or "+
. So for example you can visually select a line using V
and then yank to your system clipboard with "*y
. MacVim and some other GVims have a system clipboard menu option and hot key built into them. Try mapping the clipboard yank to a key in your ~/.vimrc like:
vnoremap <C-v> "*y
Then you can visually select with your mouse and hit CTRL-v to copy to your system clipboard.
Select the text you need then go to the place where you want paste and press right click button. Of course you need to press Insert before this.
First, look to map the mouse to this with
vnoremap <RightMouse> "*y
Debugging beyond that: see if your right-click is mapped in an awkward way. Look to guides for how to expressly map these as needed, or examples. Sadly, this may be in the compiled code (of the windows vim app) itself. Look to what remapping options you may have that are unique to Windows.
Remember , as well, to watch for the same behavior on paste. You need to type i
before you rick-click, which is paste.
What can often happen is when you right-click is pasting in the string, which then acts just like you were typing. So Vim doesn't enter insert mode
until is gets to a character like i
or a