Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yanking lines from a buffer that isn't the active one

Tags:

vim

Let's say there are two loaded buffers/files and they are both displayed via split windows, line numbers are enabled and thus known.

Is there a way to stay in one buffer, specify a line of the other buffer and yank it so it can be put into the active buffer?

like image 277
Erius Avatar asked Jun 02 '12 22:06

Erius


1 Answers

:let @0 = join(getbufline('#', 42), "\n") . "\n"

(Replace # with the name of the other buffer and 42 with the line number within the other buffer.)

like image 151
ephemient Avatar answered Sep 25 '22 16:09

ephemient