I am having a problem in copying certain text from a file then copying it to a new split window.
3yy|new|p
in command mode its working
as when i press
'p' in split window after copying its working
The Clipboard task pane holds many of the last images and text you copied or cut. Note: You can still do simple cut, copy, and paste the way you're used to, either by using the buttons on the ribbon or the keyboard shortcuts CTRL+X (Cut), CTRL+C (Copy), or CTRL+V (Paste).
Once you have selected text in Vim, no matter whether it is using the yank or the delete command, you can paste it in the wanted location. In Vim terminology, pasting is called putting and the function is utilized with the p command. Using this command pastes the selected text after the cursor.
When using Vim under Windows, the clipboard can be accessed with the following: In step 4, press Shift+Delete to cut or Ctrl+Insert to copy. In step 6, press Shift+Insert to paste.
I understand that you want to:
Is that correct?
What I don't get is why you would want to do it from Ex mode while it's so easy (and working) in normal mode:
3yy
:new<cr>
p
I think that you are confusing ex mode, accessible with Q
and command mode, accessible with :
. You probably also confuse the :p[rint]
command and the :pu[t]
command.
Do the following from normal mode:
:.,+2y|new|put!
It may be helpful to know that you can also directly write those three lines to a file with:
:.,+2w filename
You can use one of the following to copy from the clipboard in Vim:
"+p
"*p
SHIFTINSERT
Which one you use depends on your environment.
If you're using gVim or MacVim, you'll want "+p
If you're using Vim from the command line, you'll want "*p
If you're in insert mode or ex mode (I think) you use SHIFTINSERT
By insert I mean the key over by HOME, PAGE UP, and DELETE
Explanation:
"
means you're going to specify a register
+
or "
refers to the unnamed buffer, which represents the system clipboardp
is the normal put commandMore info on buffers:
If you want, you can store different text in different buffers.
To yank 3 lines to the buffer named x use this:
"x3yy
To paste the contents of the buffer named y above the cursor:
"yP
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With