Reputation: 5793
I want to copy N lines above the selected position. yNy
works for copying the below N lines.
What is the command for copy N line above the selected position?
Upvotes: 8
Views: 4564
Reputation: 392833
Or, use :<range>yank
(see :he range
for all possible uses of range)
:-3,-1y
this does precisely what you ask: yank only (e.g. 3) lines before the current line. You could
:-1y
:-2y
to yank just the previous (or pre-previous) line etc...
:1,-1y
to yank everything till the last line
:1,.y
for that including the current line (of course, you could do that with ygg
)
Upvotes: 4