How do I use an expression in a substitution to perform arithmetic on matched numbers?
:%s/\(\d\+\)/\=submatch(1)+1/g
Vim's substitute command supports using a VimScript expression as the replacement by prefixing it with \=.
:%s/\(\d\+\)/\=submatch(1)+1/g
Vim's substitute command supports using a VimScript expression as the replacement by prefixing it with \=.