Ask HN: What is your favorite lesser known VIM shortcut you can share
11 points| irishmansevilla | 1 year ago | reply
Why it's helpful: It acts like a time machine for your edits! If you regret changes but don’t want to undo manually, you can jump back in time.
You can also use it with changes, e.g., :earlier 5c (5 changes earlier).
[+] [-] riddley|1 year ago|reply
[+] [-] kkoncevicius|1 year ago|reply
Another example, say we want to delete from "two" to "five".
'd/five' would leave a "t" as well as "five", but 'dV/five' would delete all necessary lines. This helps targeting lines without using relative line numbers.[+] [-] tmaly|1 year ago|reply
I find this shortcut useful to delete all blank lines in a file
:g/^$/d
[+] [-] btschaegg|1 year ago|reply
Edit: Oh, also, since vim ships with xxd: xxd -r -p is a very useful thing to know.
[+] [-] zeke|1 year ago|reply
:33Lexplore opens the split with a slimmer, 33% width, window. :Lex<tab> to autocomplete if you do not want to type as much.
[+] [-] croo|1 year ago|reply
[+] [-] scrapheap|1 year ago|reply
[+] [-] pizza|1 year ago|reply
[+] [-] riddley|1 year ago|reply