Fork me on GitHub
Daniel Hines21:04:47

How do you search and replace in spacemacs? * works nicely when it’s a symbol, but I want an arbitrary string/regex. I see references to Alt + %, but that only prints “∞” for me.


Hum, I use spacemacs in non evil mode.


So might be different for you


But I do M-x anzu-query-replace


SPC s e will start iedit mode and if you have some text selected it will let you change all instances. You can couple this with SPC n r, where you select a range of text and narrow to just working on that region. SPC n w to widen your narrow and see the whole file again.

Mario C.23:04:01

@d4hines I usually do :%s/<regex>/<regex>/gc the gc flag is global search and asks you to confirm the search & replace.

Mario C.23:04:13

Idk if that helps