Is it possible to capture the number of 'yes' clicks in a substitute command with confirmation?
p.e.
:%s/foo/bar/gc
replace with bar (y/n/a/q/l/^E/^Y)?
number of y
clicks = ?
Is it possible to capture the number of 'yes' clicks in a substitute command with confirmation?
p.e.
:%s/foo/bar/gc
replace with bar (y/n/a/q/l/^E/^Y)?
number of y
clicks = ?
If you want to know how many substitutions were done (the number of y
), after all occurrences confirmation were asked, you will see X substitutusions on Y lines
, the X
is what you want.
If you are writing a script and you want to get the number in your script. You can either implement this counter in your function, or before the :s/../../gc
, redir @x
after all substitutions were done, redir END
. Read @x
, take the last line, extract ^\d\+
, that would be the number.