I would like to use Vim to find certain string and replace it with another. For every replacements, it should ask for confirmation similar to what %s/foo/replace/gc
does for a single file in Vim.
What have I tried?
- sed: It doesn't do interactive replacements.
- One of the comments in the following this link suggests
vim -esnc '%s/foo/bar/g|:wq' file.txt
. I triedvim -esnc '%s/foo/bar/gc|:wq' file.txt
(used gc instead of g). Now the terminal gets stuck. - Emacs
xah-find-replace
package. Unfortunately it didn't do interactive replacements as promised in the link.