I have a prepared statement in java that i am adding an argument to the front of. Long story short, I have to take a ton of set methods and increment their first argument by 1.
I'd like a quick way to do a search and replace matching all numbers, and then increment them by one.
Figured it out.
%s/\d\+/\=(submatch(0)+1)/g
http://vim.wikia.com/wiki/Using_an_expression_in_substitute_command
The only regex you need to know is \d
.
:g/\d/exe "normal! \<C-A>"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With