In vim, I could use :%sno/[abt]//g
to remove all text of "[abt]" literally (as explained here).
I tried the same command in evil-mode
, but it complains it doesn't understand the sno
command, so how can I do the same thing in evil-mode
?
In vim, I could use :%sno/[abt]//g
to remove all text of "[abt]" literally (as explained here).
I tried the same command in evil-mode
, but it complains it doesn't understand the sno
command, so how can I do the same thing in evil-mode
?
To my knowledge, evil
does not (yet?) support the "magic/no magic" regexp options (actually, it only does a smallish subset of ex
functionality, so I don't think ). As @Ehvince's answer suggests, the standard Emacs way to do the replace is with %
will work eitherquery-replace
or query-replace-regexp
. If you'd like to stick to evil
, just escape the square brackets with a backslash:
:s/\[abt\]//g
NB: backslash escapes in Emacs often bite people coming from other environments or programming languages; have a look at the bottom of this manual node on the backslash for more information.
You would use the emacs command query-replace
bound to M-%
:
M-% [abt] RET <nothing> RET
and then approve each occurence with y
or all with !
.
The doc is at C-h f query-replace
.
query-replace-regexp
is bound to C-M-%
.