Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 & paste without this issues?

Thank You

share|improve this question
1  
What terminal are you using? A number of them treat right-click as "paste"... –  Darth Android Jul 2 '12 at 16:49
add comment

4 Answers

up vote 2 down vote accepted

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.

share|improve this answer
    
v for visual, shift+v for visual line, and ctrl+v for visual block. –  Rob Jul 3 '12 at 18:19
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
    
OP trying to get the right-click menu like on windows to perform a copy/cut ... not a paste (yet). Good info though. –  lornix Jul 2 '12 at 17:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.