Hacker News new | ask | show | jobs
by gopher_protocol 2669 days ago
I'm not arguing that Kakoune's way isn't better (I think it probably is). But you can sort of do this in Vim as well, minus the more advanced interactive adjustments:

- :set hlsearch

- Type `/`

- Spend five seconds thinking up a regex that approximately matches the things I want to change

- Hit Enter

- Cycle through matches with `n`/`N`, checking to see if they're what I expected

- If they're not, press `/` then <Up> and edit the regex

- When satisfied, type `:%s//`, enter the replacement you want to make, then `/g<Enter>` to apply the change everywhere

1 comments

You can also just change the command to something like :%s/regex/replacement/gc

The "c" modifier makes you confirm each replacement, and you can y/n for each of them.