Skip to content

Instantly share code, notes, and snippets.

@diyinfosec
Last active July 28, 2020 07:56
Show Gist options
  • Save diyinfosec/e3de2d61c5fc72cc4739ca4c3cf2153d to your computer and use it in GitHub Desktop.
Save diyinfosec/e3de2d61c5fc72cc4739ca4c3cf2153d to your computer and use it in GitHub Desktop.
Simple macro with vim:
Usecase: Join evey other line in a file to the previous one.
We can do this easily using macros:
1. start recording a macro 'q': qqJjq
2. replay the macro 'q' 500 times: 500@q
(Actually it is not a macro called 'q', it is a named register called 'q'. instead of interactively fill that register as in (1), you could also do :let @q = "Jj" and then do 2.)
Source: https://superuser.com/questions/168942/how-to-join-every-second-line-in-vim
To go to a charcter in a line:
f<character>
Example: f{ will take you to the first { in the line (from the cursor position)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment