I would like to use the arguments passed to a function, as an argument to replace a search.
Something like this:
function! Myfunction(...) %s/hello/ goodBye a:1, a:2/g endfunction
Does anyone know how it can be done?
If you can have any number of parameters, you'd have the choice between the following (untested) solutions
:exe '%s/hello/ goodbye '.join(a:000, ', ').'/'
(expecting the parameters contain no backslashes) or
:%s/hello/\=' goodbye '.join(a:000, ', ')/
This second solution works only when the dynamic part is used in the replacement text, not in the searched pattern.