vim macro
Did some overleaf work today, which requires removing all delete tags in the file, i.e. \sout{foo-bar}
. This operation is repetitive (find the command, then enter visual mode, move forward 2 words, find the match of the bracket) and can be automated with vim macro. After recording it with key q
, then :g//normal! @q
to apply it to all matches.
Similarly, I used :g//normal! @q
to remove all the \revise
tags in the file. Thought brackers were left behind, it’s okay for me.
Suprisingly, it is the first time I used vim macro for 4 years since I started vim. Never thought the regex or :g
command can be so powerful.
Enjoy Reading This Article?
Here are some more articles you might like to read next: