Friday, October 30, 2009

Repeat Last Substitution

If you want to repeat your last substitution on the current line hit the "&" character from normal mode.

5 comments:

Anonymous said...

You mean normal mode.

Mark Wilden said...

This is a good tip, but unfortunately & doesn't respect the scope, so you can't just do :%s/foo/bar/g, then bop from file to file and hit & to repeat it.

Travis Whitton said...

@anonymous - Yeah this would obviously just type a literal & in insert mode. That's what I get for posting a tip around midnight...

Anonymous said...

nice. I didn't know that one :-)
thx

knicker said...

Thanks :)