The Structure of a Vim Plugin

Vim reads VimL files from several different directories under its home directory, which will be kept in your user directory. On OS X and Linux it looks for these directories under .vim/; on Windows they live in a directory called vimfiles.

  • plugin: This is the main directory for plugin script files. A Vim plugin can be as small as a single file that lives in this directory.

  • autoload: The autoload directory stores VimL script files that are loaded on demand. You’ll learn about Vim’s autoload system in Chapter 3, The Autoload System.

  • ftdetect: This is where we place VimL files that detect the type of file Vim is editing.

  • ftplugin: Almost like plugin, this directory is used mainly by filetype plugins. The ...

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.