One of my favourite things about Kakoune is global regex replacement. In Vim, it usually goes like:
- Type `:%s/`
- Spend 30 seconds thinking up a regex which will hopefully match all the things I want to change, and none of the things I don't
- Write it out, hit Enter
- Run my tests, or run "git diff", or generally review the changes, and find a bunch of stuff is broken
- undo, restart from scratch
You can sometimes avoid screwing up the entire file with the "c" flag that asks for confirmation for each change, but it's too easy to get bored and distracted and type "y" too many times.
In Kakoune, a global regex replacement goes like:
- Type `%s`
- Spend five seconds thinking up a regex that approximately matches the things I want to change
- Interactively do any additional adjustments that are difficult to express in regex, like the `M` command that extends the selection to the next matching bracket
- Cycle through matches with `(` and `)`, checking to see if they're what I expected
- If not, I can remove individual selections with Alt-Space, or just hit %s and adjust my regex
- Type `c` and actually make the change
Because of the whole "multiple cursors" thing, I can get fast feedback on each part of the process, so I can get the result I want much more quickly.