Vim: straight lines above the current line along with the current line

I often do Nyy to print the current line and N-1 lines below. So 3yy will delay the current line and two more lines (so all together 3).

I know how to pull N lines above the current line ( yNk ), but this does not include the current line. I want to output the current line and lines N-1 above. How to do this (ideally also with the yy command)?

Edit: Apparently yNk includes the current line. I must have missed this. thanks for the comments.

+4
source share
1 answer

The following will delay the current line plus two above:

 2yk 

Obviously, a change of 2 will result in a change in the number of rows pulled above. The number is not implicit 1 , so yk equivalent to 1yk .

+10
source

All Articles