I'm not sure if the title makes sense, but I'll try to explain what I'm trying to do.
I have a file with some code like:
some_var = 3; ... func(some_var);
The file has a bunch of calls to
func and I'd like to find all occurrences of the variable passed to each call. In this case I'd like to find
some_var on the line where it is assigned as well as where it is passed to the function. Unfortunately the variable name may differ in each instance, so I can't just search for the variable name directly.
Is there some way to search for the call to the function, capture the argument passed to it and then set the search pattern to that argument?
I tried the following, but it seems sub-expressions don't work with the
:g/func(\(\w\+\))/let @/ = \1