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

Is there a way by which I can request Vim information about vimscript custom functions and script files that Vim knows about?

What I would like to know is:

  • Is a specific function defined?
  • What source file is a given function defined in?
  • What are the vimscript files that were received?

Etc.

+4
source share
1 answer
  • Is a specific function defined?

Use the exists function:

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

Unfortunately, there is no direct way to do this. You should analyze the output :verbose function .

  • What are the vimscript files that were received?

Again, there is no direct way to do this. You should :scriptnames output :scriptnames .

What big picture for what you are trying to do made you ask these questions? Perhaps there is a better way to achieve this without requiring answers to every question.

+12
source

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


All Articles