

I can’t recommend any, never having used them, but they are out there. There do exist multi-cursor-emulation plugins for vim. Or :cfdo %substitute if you know you want the whole of each file.ĭon’t forget to :cfdo update or just :wall afterwards. These can be quite powerful, and a full overview is out-of-scope ( :help ).Ī slightly more advanced option: do a search ( :grep, :vimgrep, &c.) or some other operation that fills the quickfix list ( :cexpr, :make) and then cdo substitute/pat/repl/flags If you want to substitute in a narrower region, than the whole file ( %), use ranges (and remember that in visual mode, : automatically populates the range ', which is also the range *, which is all the lines in the selection). If you want to do this with a visually-selected pattern, I would yank it, followed by %substitute/"//replacement/gc These are somewhat equivalent to %substitute/\=expand('')\>/replacement/gc If you already searched for the word, ignore the * and just cgn. So you put your cursor somewhere in a word, press *cgn, type the replacement, hit, and then hit. *: start a search for the word under the cursor ( g* if you don’t want the word boundaries).So, not really what you asked for, but: *cgn

If not, I would probably proceed with either multiples of the steps below, or combine all the patterns into a single substitute pattern. I’m assuming all the things to change are the same. As the main goal is to change a word locally, the combination *cgn Is perfect.Īs I'm changing the also the current word and * jumps me to the next match, what I add to go back to that word is Ctrl + N. Ben Knoble you provided to me the more convenient and practical answer.
