How do I increment or add to all numbers in a file using Vim substitution?
:%s/\d\+/\=submatch(0)+1/g
Vim's expression replacement (\=) in substitutions lets you perform arithmetic on matched text.
:%s/\d\+/\=submatch(0)+1/g
Vim's expression replacement (\=) in substitutions lets you perform arithmetic on matched text.
<C-v>jj<C-a>
Select numbers with visual block mode , then press to increment all selected numbers by 1.
<C-a> / <C-x>
Pressing increments and decrements the number under or after the cursor.