Repeat subs with `g&` and `:&` and `:&&`
The tricks from Vim Un-Alphabet keep coming. Repeating your substitution is a cool trick and you can do it one of 3 ways.
g&
will repeat the last substitution you did, but for the whole file, whatever file you're in at the moment.
:&
will repeat the last substitution on the line you are on but you get to change the flags if you want. So you can decide now to make it global with :&g
.
:&&
will repeat the last substitution on the line you are on with the flags you used for that substitution.
3 very nice tricks to smooth out your workflow when making substitutions.
Tweet