← All tips

Building Numbered Lists

You might already know about <C-a> and <C-x> in Vim, which allow you to increment or decrement the number under the cursor respectively.

You can take this behaviour even further with g<C-a> and g<C-x>, which can be used to create ascending or descending lists of numbers.

It’s best to learn this one by example, so let’s try it. In the editor, select all of the 0 lines with visual mode, then hit g<C-a>.