vimtricks.wiki Concise Vim tricks, one at a time.

How do I load plugins without a plugin manager using Vim's built-in package system?

Answer

:packadd

Explanation

Since Vim 8 and Neovim, Vim has a built-in package system that can load plugins directly from the filesystem — no external plugin manager required. Plugins placed in pack/*/start/ load automatically at startup; plugins in pack/*/opt/ load on demand with :packadd.

How it works

Vim's packpath option points to directories where packages live. The default includes ~/.vim/pack/ (Vim) or ~/.local/share/nvim/site/pack/ (Neovim).

Auto-loaded plugins (start directory):

~/.vim/pack/plugins/start/vim-commentary/

Vim sources all plugin/*.vim files here automatically on startup.

Optional plugins (opt directory):

~/.vim/pack/plugins/opt/vim-fugitive/

Load on demand in your vimrc or interactively:

:packadd vim-fugitive

Example

To install a plugin without a plugin manager:

" Clone directly into the start directory
" git clone https://github.com/tpope/vim-commentary \
"   ~/.vim/pack/tpope/start/vim-commentary

" For optional/lazy plugins:
" git clone https://github.com/tpope/vim-fugitive \
"   ~/.vim/pack/tpope/opt/vim-fugitive

" In your vimrc, load it conditionally:
packadd! vim-fugitive

The ! form (:packadd!) loads the plugin without running its after-directory scripts.

Tips

  • Use git submodule to track plugins as submodules in a dotfiles repo: git submodule add <url> .vim/pack/tpope/start/vim-commentary
  • :helptags ~/.vim/pack/tpope/start/vim-commentary/doc/ generates help tags for the plugin
  • :scriptnames shows all loaded scripts, which helps debug load order issues
  • Neovim users: the equivalent path is ~/.local/share/nvim/site/pack/

Next

How do I define autocmds safely so they don't duplicate when my vimrc is re-sourced?