this post was submitted on 17 Jul 2024
83 points (97.7% liked)
Ask Experienced Devs
1230 readers
1 users here now
Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Where editors usually have editing shortcuts, vim has an editing grammar.
So you can copy (or select, or replace, or delete, or any other editing verb) N arguments or blocks or lines or functions or any entity for which vim has an editing noun, or around or inside either of these, and you only need to remember a few such editing verbs and nouns and adjectives in order to immediately become much more effective.
It's so effective that switching back to a regular editor feels annoyingly clunky. (I guess that's why many offer vim plugins these days.)
Better: you can record entire editing sentences and replay them. Ever had to make the same change on dozens of lines? Now you can do it in seconds.
Now of course, replaying a sentence, or several sentences, is also a sentence of its own that you can replay in another file if you want.
It's neat. :)
I think my first experience with that kind of macro recording/replay was with Dwarf Fortress, of all things.
I had no idea DF had macros but it makes so much sense.
CTRL R starts recording the inputs, press again to stop. CTRL P plays it. Makes digging magma shafts through several floors, then setting up the pumps, so much easier
I didn’t know this and tried to record on my keyboard a macro, and DF blocked me when I tried to use my keyboards built in macro keys. I guess that makes sense.