I would like to delete some prefix from all words in document using VSCodeVim plugin. For example:
var someVarOne, someVarTwo, someVarThree;
delete prefix 'some' and get:
var VarOne, VarTwo, VarThree;
Thanks in advance!
I would like to delete some prefix from all words in document using VSCodeVim plugin. For example:
var someVarOne, someVarTwo, someVarThree;
delete prefix 'some' and get:
var VarOne, VarTwo, VarThree;
Thanks in advance!
Try:
%s/some\(Var\w*\)/\1/g
\(...\)
defines a group\w*
one or more word chars\1
replaced with the first group (whatever matched by Var\w*
)Assuming your var are camelCase as you showed and that only the "some" word is known (i.e., "Var" might change) try this regex:
some(([A-Z][a-z]*)+)
and replace with \1
Works on
var someVarOne, someVarTwo, someVarThree, someOtherVar, someVar, someThing;
var some;
producing:
var VarOne, VarTwo, VarThree, OtherVar, Var, Thing;
var some;
Since the substitution methods have already been mentioned, you could try this simple method: