Vim has the following setting:

:help gdefault

When on, the ":substitute" flag 'g' is default on.  This means that
all matches in a line are substituted instead of one.  When a 'g' flag
is given to a ":substitute" command, this will toggle the substitution
of all or one match.

How do I get this behavior in evil-emacs?

1 Answer 1


There is a variable named: evil-ex-substitute-global

If you check it with C-h v, it will give you the explanation:

If non-nil substitute patterns a global by default. Hide Usually (if this variable is nil) a substitution works only on the first match of a pattern in a line unless the 'g' flag is given, in which case the substitution happens on all matches in a line. If this option is non-nil, this behaviour is reversed: the substitution works on all matches unless the 'g' pattern is specified, then is works only on the first match.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.