Reputation: 309
When edit markdown list with Vim, I usually got what i think i want like this first:
1. item
2. item
3. item
4. item
but then realize that i forget something in the middle, so i insert one line in the middle, so the file become this
1. item
2. item added
2. item
3. item
4. item
I know that in markdown the list number do not have to be ordered, but i think it not easy to read, so i want to change the list number to be in ascending order like this.
1. item
2. item added
3. item
4. item
5. item
I know that i can use this command for that:
let i=1 | g/\d. /s//\=i.'. '/ | let i=i+1
But it will change all list number in the markdown file, how can i run this command in visual mode of Vim.
Upvotes: 1
Views: 886
Reputation: 11810
My suggestion:
https://github.com/triglav/vim-visual-increment
Why? It allows you to perform the same kind of task easily.
Upvotes: 1