The vimscript help files state that when defining a user function:
The function name must start with an uppercase letter, to avoid
confusion with builtin functions.
This is enforced except in the following cases that I discovered by looking at other’s code.
"This should not work.
"But it does as long as the function is in a file called 'overrides.vim'.
function! overrides#name() abort
echo 'Test overrides\name'
endfunction
"This should not work either.
"But it does as long as the file above is in a folder called 'plugin'.
function! plugin#overrides#name() abort
echo 'Test plugin\overrides\name'
endfunction
let stupid = {}
"This should not work.
"But it does aslong as the stupid Dictionary is defined.
function! stupid.name() abort
echo 'Test stupidname'
endfunction
call overrides#name()
call plugin#overrides#name()
call stupid.name()
I looked everywhere for anything that would explain this syntax. I know this works now. What I am very curious about is, for those of you have used this syntax, where did you learn about it?
Are there other vimscript functionality that are not mentioned anywhere in the help files?
This naming syntax is for
autoloadfunction. Type:help autoload-functionsfor help.