How do you use a function in the replacement of a substitution?
Answer
:%s/\d\+/\=submatch(0)*2/g
Explanation
Use \= to evaluate expressions. submatch(0) is the full match. This example doubles all numbers in the file.
:%s/\d\+/\=submatch(0)*2/g
Use \= to evaluate expressions. submatch(0) is the full match. This example doubles all numbers in the file.