Vim Tips Wiki  Repeat command on each line in visual block
1,604pages on this wiki  Redirected from VimTip84  Tip 84
Printable Monobook Previous Next  created June 29, 2001 ·
complexity basic · author Salman Halim · version 5.7  One of the
things i do a lot in Vim is to make a change to the beginning or
end of the line (such as adding the text '// remove' at the end
of java debug code). a quick way of doing this is to use a to
append the text to the end of the first line and then move down
one, hit . (repeat last edit), move down, hit . etc. etc. the
following mapping allows one to simply highlight the region in
question and hit . -- it will automatically execute the . once
on each line:  " allow the . to execute once for each line of a
visual selection vnoremap . :normal .<CR>  Another thing i do a
lot is to record a quick macro in the "a" register and then play
it back a number of times. while @@ can be used to repeat the
last register used, my recorded macros sometimes use other
registers so @@ doesn't ne