I am new to Vim plugins and am looking to use the vim-plug plugin manager. The installation instruction advises me to download the .vim file and add it to ~/.vim/autoload.

curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

This answer suggests that vim-plug is itself a plugin. However, several answers have suggested placing plugins that comes as a single .vim file in the ~/.vim/plugin directory.

I understand that some directories under ~/.vim has special meaning. The ~/.vim/autoload directory is to house autoload scripts that are invoked when the function is ran. These functions can be ran by plugins or just used generally. The ~/.vim/plugin directory are for plugin scripts, which are sourced by Vim when it starts up.

So why should the plug.vim script be added to the autoload directory and not plugin?

1 Answer 1


Choosing between plugin/ and autoload/ is a matter of how a plugin designer intends the plugin to be used. vim-plug is intended to be placed in autoload/ because it is initialized through functions named plug#[...]. vim-plug is not loaded and does nothing until you call one of these functions. This is a better practice than using plugin/ because if the user installs the plug.vim file but does not use it, there is almost no impact to startup time. The small downside is that you actually need to place call plug#begin() in your vimrc, and this was the choice made.

vim-plug's plug.vim cannot be placed in plugin/ because the function naming scheme plug#[...] is valid only in autoload/.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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