Another solution is to use macros (I love macros!).
First put return
in the search register: /return<CR>
or :let @/="return"
Then record your macro:
qqnwiverify(<Esc>ea)q
which can be decomposed like this
qq start recording in the register q
n go to the next occurence of the word in the search register (here 'return')
w go to the beginning of the word following 'return'
i enter insert mode
verify( input the function which will encapsulate your variable
e go to the end of the word after the bracket
a enter insert mode after the word
) input the closing bracket
q stop recording
You can then execute the macro with @q
and repeat it with @@
.
Edit Thanks to @Nobe4 you can even make it one keystroke shorter this way:
qqnwiverify(<c-o>w)q
<c-o>
allows to go into normal mode for only one command and then go back automatically to insert mode.
:%s/return \(\i*\);/return verify(\1);/
?