Vim Tips Wiki
Advertisement

Proposed tip Please edit this page to improve it, or add your comments below (do not use the discussion page).

Please use new tips to discuss whether this page should be a permanent tip, or whether it should be merged to an existing tip.
created December 7, 2010 · complexity basic · author Mbasov · version 7.0

To write numbers for a numbered list:

move to the first line of list, then

ma

(mark current position with marker 'a'),

then move to last line of list, then execute:

:'a,.g/^/exe ":s/^/".(line(".") - line("'a") + 1)."^I/"

(^I - is <Tab> symbol, for example)

Comments

This should be replaced with a redirect to Insert line numbers 2 where the same idea was added as a comment. I improved that comment (it's at the end of the tip). JohnBot 06:46, January 25, 2011 (UTC)

Advertisement