It’s sometimes more fun to find one or two slightly useful shortcuts and spam them any chance you can as opposed to reading a cheatsheet. Also, writing it here makes it easier for me to remember to use them again. Here are a couple of nice movements that I’ve found:
o/O: Add a new line and go into insert mode. There are no additional words needed to describe its infinite usefulness.=: Indent the file. Especially great after I’ve let a file of code go to chaos. Of course, this isn’t always perfect but if anything, it beats stylua, which makes my snippet code an absolute mess.t: Apparently tags are a thing?~, C-a/C-x: Used to change the case of letters and increment/decrement numbers respectively. Sure, you can use r as well, but having these keymaps makes things slightly faster.([num])C-a/C-x is life-changing.s: For surrounding, not delete and go into insert mode. I can’t believe I’ve used (Neo)vim for so long and haven’t been on the surround wave.zz: do not remap this to save. Centering your cursor is more important.z. is also a good choice too, and as I try to swap to Dvorak, I find this more and more useful.zt (cursor to the top) and zb (cursor to the bottom)?!@macro while recording @macro: I accidentally forgot to stop recording my macro, and I did @macro by accident before stopping. This resulted in a self-referencing macro which did the work for me, which was very nice."[reg](y|p): custom registers saved me so much time when typesetting math..: how I went over a year being a Vim enjoyer and didn’t know this shortcut is still surprising.%: I forgot the keybind to find the matching delimiter/parentheses or whatever the right word for this is. But now I won’t.submatch([num]): “I’d like to use match groups in (Neo)vim but I don’t think they have it” - me, some while ago. They do, as I found out one day after looking for something else entirely. Why I did not do a simple search online earlier still baffles me to this day.#: keep accidentally pressing this (similar to . sometimes as well) and just found this to be annoying since it’ll highlight the word under the cursor. Except for this is incredibly helpful for finding other instances of a word under the cursor (yes, I know I have vim-illuminate) but still I end up pressing # more often and find n/N more useful to move around. Maybe that’s just a sign I should stop using this plugin.C-o: Why do all the best commands always have o in them? One can only wonder. Anyways, this is another one of those commands I found once and can’t stop spamming for the life of me. This is for executing a singular command as if you were in normal mode while staying in insert mode. It’s a huge lifesaver for the countless times I’ve used jkla to move around and type outside of a parentheses or code block.C-[hjkl] moves around windows or calls a split (which is also slightly punishing for spamming keymaps until you find the right one)C-[up|down|left|right] resizes windows. I’m not too sure how I feel about that one just yet; I might try C-S-[hjkl] as well. It’s a tough battle as this exact key combination is also a thought I’m having for creating a new window without it being a split, but writing a function that can swap between these functionalities, while interesting, feels very wrong (and can also lead to unintended behavior).Lua code for the C-[hjkl] mapping:
| |