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
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
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
p is just vi command, so it should be pu in ex instead. or you can do with double quote, "p or "np. n is for the number in the register of buffer, "2p means the 2nd oldest yank you made.