xxx <=> zzz
Original text:
xxxyyyzzz
Run command:
:s/???/???/
It becomes:
zzzyyyxxx
Run t开发者_高级运维he same command above:
:s/???/???/
Back to the original text:
xxxyyyzzz
just like toggle case(~)
aBCdeFg
<=> AbcDEfG
Take a look at this: Can I substitute multiple items in a single regular expression in VIM or Perl?
Try this:
:s/(...)(yyy)(...)/\3\2\1/
You could always write your own macro. I'm assuming a macro for this specific example would not be helpful to you, but I could post one if you want.
精彩评论