How to paste from buffer in ex mode of vim?

buffer, linux, vim

Solution

I understand that you want to:

- yank the current line and the two lines below in the current buffer,

- open an empty buffer in a new horizontal split and

- paste those three lines in the empty buffer.

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

Problem

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

Original source

Related problems