Skip to content

Instantly share code, notes, and snippets.

@bibstha
Created July 15, 2022 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bibstha/fd88348aa9370717617d428a50273df3 to your computer and use it in GitHub Desktop.
Save bibstha/fd88348aa9370717617d428a50273df3 to your computer and use it in GitHub Desktop.
Vim command to play keystrokes on each matching line

Given

a1, b1, c1, d1, e1 
a2, b2, c2, d2, e2

I could do :g/,/normal 2nd$ to delete everything from second , onwards to give sth like

a1, b1
a2, b2

It’s cool that :g can play keystrokes on matching lines, sort of like macro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment