4 ms·
One vim hack I like is multi-line macro application. It's a good fallback in case, as I often forget the syntax for certain things. To facilitate this, I've rem
by gaogao 6y ago
One vim hack I like is multi-line macro application. It's a good fallback in case, as I often forget the syntax for certain things. To facilitate this, I've remapped ctrl-space in visual line mode to apply my `q` macro to every selected line.
As an example, say I need to add a comma to a bunch of lines. I will record the macro on that line appending a comma to the end, visually select all of the other lines to copy the macro on, and then jam my hotkey to apply the macro.
It's often much quicker than reaching for a regex for short segments of code.
- RMPR 6y agoFWIW, your particular example is doable with vanilla Vim with the same efficiency (with less strain) V<count>j (3) :'<,'>norm A, (8 - The angular brackets are automatically added by vim) Vs qq (2) A,<ESC> (3) q (1) V<count>j (3) <CTRL><Space> (2)