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?
yNk
will copy the line you're on and the N preceding lines.
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
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With