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).
1–10 of 10 posts
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).
# open some files in vertical splits
> ls $FILES | nvim -O
# -o does horizontal splitsnot a shortcut but still tremendously useful when I need it: # open some files in vertical splits > ls $FILES | nvim -O # -o does horizontal splits
:33Lexplore opens the split with a slimmer, 33% width, window. :Lex to autocomplete if you do not want to type as much.
I find this shortcut useful to delete all blank lines in a file
:g/^$/d
one two three
^
'db' would leave letter "e" behind. But 'dvb' would include the "e" as well.Another example, say we want to delete from "two" to "five".
one
two
^
three
four
five
six
'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.sometimes when I copy data into a file, I get some blank lines depending on how the data was formatted. This can often happen when copying from websites. I find this shortcut useful to delete all blank lines in a file :g/^$/d
Edit: Oh, also, since vim ships with xxd: xxd -r -p is a very useful thing to know.