Thursday, October 9, 2025

How to delete all lines above and below the current line in the text editor vi

In vi (or vim), you can delete all lines above the current line with this one simple command:
:1,.−1d
To delete all rows above the current lin, press d (delete) followed by capital G (end of document):
d + G

No comments:

Post a Comment