开发者

Vimscript: how to get the current list of user-defined functions and determine the files they are sourced from

开发者 https://www.devze.com 2023-01-01 19:24 出处:网络
Is there a way I can query from within Vim information about user-defined vimscript functions and script files that Vim knows abo开发者_JS百科ut?

Is there a way I can query from within Vim information about user-defined vimscript functions and script files that Vim knows abo开发者_JS百科ut?

The things I'd like to know are:

  • Is a particular function defined?
  • Which source file is a given function defined in?
  • What are the vimscript files that have been sourced?

Etc.


  • Is a particular function defined?

Use the exists function:

:echo exists("*funcname")
  • Which source file is a given function defined in?

Unfortunately, there's no straight-forward way to do this. You would have to parse the output of :verbose function.

  • What are the vimscript files that have been sourced?

Again, there's no straight-forward way to do this. You would have to parse the output of :scriptnames.

What's the big picture for what you're trying to do that made you ask these questions? There may be a better way to achieve it without needing answers to each question.

0

精彩评论

暂无评论...
验证码 换一张
取 消