Besides the question of “do you really need this?”, Here is a trick:
"foo "bar let a = 5 let a = 5 let a = 5 call Foo(search('very special string')) let a = 5 let a = 5 fun! Foo(callerLineNumber) echo a:callerLineNumber endf
this will print the line number of the line call Foo(search('"very special string"'))
well, you have to make a "really special line" in the search pattern.
source share