Gvim-Louu
Gvim-Louu

Reputation: 13

gvim: yank lines between buffers

I try to copy the lines 7,11 from buffer 2 to my buffer 3 without leaving buffer 3. Is it possible to do that with a simple command?

Usually I go to B2, yank the lines come back to B3 and paste them. I will be interest to do that using range but I do not succeed.

Upvotes: 1

Views: 134

Answers (2)

If you are using unix you can use this command:

 :r! sed -n 7,11p #2

Upvotes: 0

Ingo Karkat
Ingo Karkat

Reputation: 172510

There is the getbufline() function that allows you to obtain lines from another buffer. You can :put that into the current buffer via the expression register:

:put =getbufline(2, 7, 11)

Upvotes: 4

Related Questions