Interactive substitute, pause after regex substitution before moving to next one.

6 views
Skip to first unread message

Mosh hmi-tech.net

unread,
Apr 24, 2020, 9:00:29 AM4/24/20
to vim...@googlegroups.com
I want to view my complex substitution is correct before moving to the
next one in:

:%s,old,replacement, flags

It is problem because my regex are mutliline spanning paragraphs, and easy to
make a mistake in the replacement . So I have top stop and restart again to view
each subst is correct.

Emacs interactive search replace, has "," to view replacement before moving on:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Query-Replace.html

Is this feature possible in vim?
--
Mosh

vim 8.2 :subst flags we have are:
[c] Confirm each substitution. Vim highlights the matching string (with
|hl-IncSearch|). You can type: *:s_c*
'y' to substitute this match
'l' to substitute this match and then quit ("last")
'n' to skip this match
<Esc> to quit substituting
'a' to substitute this and all remaining matches
'q' to quit substituting
CTRL-E to scroll the screen up
CTRL-Y to scroll the screen down
Reply all
Reply to author
Forward
0 new messages