New answers tagged

3

If you're on linux, you could filter the text through the external command nl to 'number the lines of files' with the --number-width=1 argument to ensure no leading whitespace: :%!nl -w1 This outputs: 1 foo 2 bar 3 baz . . . 10 more 11 things Using the% sign means do the command for 'all lines in the buffer'. But you could also do 20,30!nl -w1 to ...


3

No mapping necessary! Vim has the & command which just repeats the last substitution. The same way as . repeats the last command, I can move to the next true and simply hit & which will apply again the last substitution. Neat and simple. I found out by googling “vi repeat last substitution” which yielded this SO post as the first result.


Top 50 recent answers are included