There's always [u]ndo. Or you can use
:earlier 2m
to go back 2 minutes in time.
Honestly this is single-handed my favorite thing about vim.
Not the ability to fluently traverse through text (and apparently time).
But that you can use it for a almost decade, and still have a stranger on the internet blow your mind with simple features you didn't know existed. There's so many of those one-off commands that are so useful, yet you've somehow never heard of them?
Wut.
~27 years of using vim, you just blew my mind.
:later 8h
One can dream...
Fair enough
I normally use u (undo) though.
If you have `set backupdir` enabled, any and all savepoints on a file are backed up with timestamps and a revision number.
A friend of mine I met through my own similar (free) library is developing this like a madman: https://kindavim.app
It costs $3/month (coffee) but for a Vim person like me I gladly pay. Making this work across macOS is a total mess and a full-time job, and it's not trivial work.
If you want a free version, I have https://github.com/dbalatero/VimMode.spoon as a Hammerspoon plugin that works pretty OK, but I'm not actively developing it and prefer the kindaVim app at this point.
- C-u and C-d to jump up/down
- [ and ] to go prev/next empty line (I have a macro to clear empty spaces at the end of lines so this works well for jumping functions in code)
- from the article: 50% to go the halfway point of a document
- 100gg to go to line 100
- 100k to go 100 lines down
Are there any more good ones?
Edit: occurs to me that you might have remapped kkk to escape normal mode. At one time I had done this for jj. Now I just use C-[ as it’s portable to vanilla vim setups and less of a stretch than the escape key.
:set relativenumber
The line the cursor is on is now shown in the left sidebar as 0, counting up for each line away from the cursor. So now it tells you what number to use for "10j" and "10k" to move up and down a specific number of lines. m[a-z]
`[a-z]
Mark a point in a file into a register, and jump back to that point. Or even more interesting: m[A-Z]
`[A-Z]
Same as above, except capital marks are global and work across files.Also,
``
Jump back to the last place you jumped from (but only within the same file).zt, zz, and zb are similar but move the text not the cursor. So, zt will take the current line the cursor is on and make it the first visible line on the screen (and keep the cursor on that line). zz to the middle, zb to the bottom.
Personally, I use [ and ] to jump around most often in code, but the above are handy when you are working with documents.
I find these handy, especially after doing a search (quoted from :h z):
- z. redraw, cursor line to center of window
- z<CR> redraw, cursor line to top of window
- z- redraw, cursor line at bottom of window
Between that and 20j and (blasphemy probably) just using the scroll wheel, that handles most of my scrolling needs.
Or just use the directional keys and PgUp/PgDown like any person in the last 30 yrs
I may still try it out. But decade long habits...
I thought it meant that you were laughing like haha (a leas in Brazil)
I didn't know it had bad connotations
Now, if there is one feature I would add to Vim, it would be "cat detection". I have a ginger cat that is irritatingly in the habit of jumping on the keyboard when he wants food.
You can only imagine how, in command mode, he effectively summons the textual equivalent of the Nine Hells of Ba'ator upon my open documents if I am not quick enough...