How to find out which line a script is called from?

I would like to know from which line a script is being called.

code:

... line 500 line 501 an <silent> 98.80.00 &Files.Test\ single\ :call Func('%')<CR> line 502 etc 

Desired result: 501

Is it possible?

0
source share
1 answer

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.

+1
source

Source: https://habr.com/ru/post/1343991/


All Articles