:earlier 10m → Moves your buffer state 10 minutes earlier.
:later 5m → Moves your buffer state 5 minutes later.<p>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.<p>You can also use it with changes, e.g., :earlier 5c (5 changes earlier).
When I'm showing people the power of vim, I often use the `i` verb, like `ci"` and how it's not a "shortcut" but instead a sentence: change in quotes. If you start thinking about vim as a language instead of a collection of things to memorize, it becomes much easier, IMO.
Maybe one lesser known is changing to visual mode within operation. A few examples (^ marks the cursor):<p><pre><code> one two three
^
</code></pre>
'db' would leave letter "e" behind. But 'dvb' would include the "e" as well.<p>Another example, say we want to delete from "two" to "five".<p><pre><code> one
two
^
three
four
five
six
</code></pre>
'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.<p>I find this shortcut useful to delete all blank lines in a file<p>:g/^$/d
:Lexplore opens a split window with a directory listing you can navigate.<p>:33Lexplore opens the split with a slimmer, 33% width, window. :Lex<tab> to autocomplete if you do not want to type as much.
I never know what is lesser known but my faviourite is: * searches for the word under the cursor, # searches backwards. You can also use n for next and N for previous hit.
Favorite is hard, but if you use vim and don't know that `.` repeats the last change then you're missing out. It's really useful for those times where you need to make the same change in lots of places in a file, but not everywhere.
not a shortcut but still tremendously useful when I need it:<p><pre><code> # open some files in vertical splits
> ls $FILES | nvim -O
# -o does horizontal splits</code></pre>