January 2015
Beginner to intermediate
85 pages
1h 58m
English
The main point of autoload is to make it easy to use reusable functions. To use a function from more than one script file, we place it in a script file under the autoload directory. Vim calls this kind of file a library script. We can call the functions in that file from anywhere else in the plugin.
There’s a special syntax for calling autoloaded functions. As an example, if we had a file called mpc.vim in the autoload directory and it contained the function FromAutoload, this is how we would call FromAutoload from another function:
| | function! ForExample() |
| | call mpc#FromAutoload() |
| | endfunction |
Everything before the # represents a part of the path to the mpc.vim file; the last piece before the # is the filename ...
Read now
Unlock full access