by chmod775 · 10mo ago · 0 comments
The only times I use "precise" movement commands like that is when I'm in the odd situation of having to ssh into something from my phone.
{ [count] paragraphs backward. exclusive motion.
} [count] paragraphs forward. exclusive motion.Consider the command `d` (delete) combined with the motions for `"`.
First we have `da"`, it deletes the everything between the pair of `"` characters that surround my cursor. Next, `di"` deletes the contents of the `"` pair.
The movement `a"` is inclusive (think 'a quote') and `i"` is exclusive (think 'inside quote'). Combined with the command you get "delete a quote" and "delete inside quote" when the mnemonics are spelled out.
I have now set all my editors to move by paragraph with ctrl+up/dn. It fits so well together with ctrl+left/right that I think it should be standard behaviour. I also set up ctrl+shift+up/dn to select, of course.
"10j" may sound useless. But "y10j50jp" is much more effective. Put that in a macro that does other stuff too, and suddenly you perform complex editions to a file containing thousands of lines of text in a few seconds.
For larger distances you wouldn't even see the text in the screen, so you don't even know how much to jump. In this situation I just spam ctrl+d, then tweak with j.
Look where you want to go, there's a number next to it. Type that number and then type j.
- already exactly know where you want to go
- figure out the relative distance either by looking to the side at relative line numbers or calculating
- move your hands to the numbers row to input numbers and back (I don't have small hands, but that still translates into a small amount of arm movement for me).
Whereas just using repeat input on jklhwe... only requires you to have a rough idea initially and leaves you plenty of time to figure out where exactly you want to stop while you're already getting there.
Besides: I don't like to think about random numbers while I'm coding. Doesn't exactly make the cursor feel like an extension of my body (imagine you had to tell your hand "move 10 centimeters left")
Another quite intuitive way I navigate is using "/something" and cycling through hits - usually you know some text that appears near the area you want to go. That was pretty much instant muscle memory.
Most of the time it doesn't really matter. But if you know you want to append to a word you can hit that target immediately by using `e` (`ea`). Or if you want to prepend, you can use `wi`.
Note that `i` and `a` have a similar pairing to `w` and `e`.
Precision. I use e/E more often than w/W when editing a line or creating macros, but w/W for moving around. But more often i search with f and jump to next match with ; if I didn't hit the target right away. / then n if I'm moving to another line.