Chapter 3The Autoload System

Vim’s autoload system lets us easily break out our plugin’s code into manageable scripts with reusable functions. There are other ways to have multiple files working together in a plugin and reuse our code, but they can get rickety. The autoload system is specifically designed for this purpose, and it also keeps our plugin’s functions from colliding with any similarly named others—in that regard we can use it to provide a form of namespace for our functions.

We’re going to start this chapter by seeing how to take advantage of autoload—and as a bonus, we’ll make our plugin a bit smarter while we’re at it. Then we’ll see how we can get text from the playlist buffer so that users are able to play a selected song ...

Get The VimL Primer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.