11

I would like to know what is the meaning of the # symbol in function names e.g.:

execute pathogen#infect()
  • Read the help related to autoload plugins. – Luc Hermitte Jul 23 '17 at 8:34
14

That's part of the autoload mechanism. From Autoloading at Learn Vimscript the Hard Way and :help autoload:

Autoload lets you delay loading code until it's actually needed, so if the following function

execute pathogen#infect()

has already been loaded, Vim will simply call it normally. Otherwise Vim will look for a file called autoload/pathogen.vim in your ~/.vim directory . If this file exists, Vim will load/source the file. It will then try to call the function normally.

Every # in the function name works like a path separator. Thus when calling a function:

:call foo#bar#func()

Vim will look for the file autoload/foo/bar.vim

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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