In addition to :91,96y a
which yanks (y
) lines 91 through 96 into register a
, (pasted with "ap
), the yanked lines can be appended to the register with:
:91,96y A
I.e. the capitalization of the A
register causes an appending operation into register a
instead of an overwrite. Capitalization of the register always works like this, e.g. :let @A=';'
appends a ;
to register a
.
Using plus (+) or minus (-) references lines relative to the current cursor position:
:-10,+10y b
I.e. it would yank(y
) 21 lines around the current cursor position and put them in register b
.
An absence of input actually represents the current cursor position as well, which means that this:
:-5,y a
would yank the text from 5 lines above to current cursor position into named buffer a
, and:
:,+5y a
would yank the 5 lines after the current cursor position into buffer a
.
Note: If you have a macro in buffer a
it was just overwritten by the previous yank, as yank registers and macro registers are really the same thing. Which is why, coincidentally, you can paste a macro, edit it, and then yank it back into it's register. I personally use letters reached by my left hand for yanks, and letters reached by my right hand for macros.
Moving blocks of text around, looks like this:
:+10,+13m.
which means move the four lines positioned 10 lines ahead of current cursor, to below the current line.
Addendum
I previously confused ya
in :91,95ya a
to be somehow synonymous with ya{motion}
where the motion was supplied by 91,95
. This was incorrect and the "a" in ya
is completely unnecessary. In my defense, my help yank
does not convey that ya
is a possible alias of yank
.