Another simple way to accomplish this is to use the g CTRL-A command in Visual mode, which increments all numbers by successively higher counts on each line that starts with a number. (See
In order to be able to use it, start by replacing all numbers with zeroes:
Then visually select everything:
And finally increment them using
The first numbered line will become
1. the second
2., the third
3. and so on, which matches what you requested.
I'd say one advantage of this approach is that it doesn't require any plug-ins and will work in any Vim. Additionally, it builds on simple commands (a very simple substitution, visual mode and a very handy increment command that can be super helpful in many situations!), rather than using heavier Vimscript and Vim variables to accomplish the task.
One problem with this approach is if you have categories that contain numbers, such as
80's Bands or
Bands from the 90's, in which case
g CTRL-A will increment those numbers too. (It acts on the first number it finds on a line of text.) So such categories need to be avoided, or preprocessed in a way that will prevent the command from acting on them.
As pointed out by @Rich, using Visual Block selection can help avoid the problem with the latter form (
Bands from the 90's), by doing a visual block selection of the first few columns instead of a linewise selection of the entire file.
So, in the middle step you could use something like
gg, followed by
CTRL-V (for visual block mode),
G and then
3l to move three characters right, selecting the four first columns and incrementing numbers appearing on those columns only.