How to jump to a vimscript file's function definition?

(I'm having a hard time searching for this particular functionality, then getting results for using ctags in Vim, and not sure how to phrase that properly...)

  • 1
    Maybe could you be more specific. Give a example of the definition you are searching, what you have done to find the definition, how it fails. This would give us more hint about what is blocking you. Oct 10, 2022 at 16:11
  • To add context, ctags generates a tags file. I believe OP is asking how this can be done by extending support for ctags to vimscript. See ctags.sourceforge.net/EXTENDING.html
    – husB
    Oct 11, 2022 at 6:22
  • Do you specifically want to use ctags, as suggested by the question title? Or do you just want to be able to jump to a Vimscript function definition, (which seems to be implied by the question's body)?
    – Rich
    Oct 11, 2022 at 9:35

1 Answer 1


I usually use the search in file functionality of Vim to find the definition of the function.

To find the definition of MyFunction I would run the command:

:vim "^fun.* MyFunction"

Or using the Ack plugin:

:Ack! "^fun.* MyFunction"

To use tags you have to be sure first that the tags files has been generated in the current directory for the project in which you are searching the function definition.

You can achieve that by running ctags explicitly:

:!ctags *.vim

Or if you prefer skip the console output to check the result

:silent! !ctags *.vim

Or by making sure a plugin such as gutentags running it in the background for you.

With this ensured you can go to the definition using the command:

:tjump MyFunction
  • 1
    @husB, I have added some more information about how to generate tags. Oct 11, 2022 at 6:48
  • 1
    universal ctags supports the "Vim" language. Also I think you mean :silent! !ctags …
    – D. Ben Knoble
    Oct 12, 2022 at 16:01
  • Thanks for spoting the mistake :-) Oct 12, 2022 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.