Skip to content

Instantly share code, notes, and snippets.

@petergi
Created April 8, 2026 15:53
Show Gist options
  • Select an option

  • Save petergi/839558fa59dadf40335b67c9f3680a53 to your computer and use it in GitHub Desktop.

Select an option

Save petergi/839558fa59dadf40335b67c9f3680a53 to your computer and use it in GitHub Desktop.
Reverse entire file. The first pass of :g marks every line matching {pattern}, while the second pass (again starting at the file's beginning and proceeding to the end) performs the [cmd]. Note: if :g processed lines in any order other than from top to bottom, this command would not work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment