
Vim tricks I use when I need operations to land exactly right
There's a category of Vim friction that isn't about speed — it's about landing in the right place. You recorded a macro that's almost right but has one wrong keystroke. You want to delete from here to a line you marked ten minutes ago. You're trying to insert newlines in a substitution and getting garbage characters instead. These aren't beginner problems, but they trip up experienced users too because the solutions aren't obvious. Here are five tricks that consistently reduce that friction. 1) Edit a macro as plain text instead of re-recording it Why it matters Re-recording a long macro because of one wrong keystroke is painful. There's a faster way: paste the macro's keystrokes as editable text, fix the mistake, and yank it back. "qp " paste register q as text onto a new line { edits } " fix what's wrong using normal editing commands 0 "qy$ " yank the corrected line back into register q dd " delete the helper line Real scenario You recorded a macro in q that processes log lines, but
Continue reading on Dev.to
Opens in a new tab




