This post was originally published on my blog.
I've just done an overhaul to my dotfiles and I wanted to document how and why I migrated from pathogen to minpac.
Why minpac
Minpac is described as a "minimal package manager for Vim 8". Ok, great. How is minpac different or better than the package managers that have been around for years (Vundle, vim-plug, pathogen, etc.)?
Now that Vim 8 ships with native package management, minpac builds on top of this functionality, allowing for a more lightweight plugin. Unlike its predesessors, minpac doesn't invent it's own solution for managing the runtimepath. Another Vim 8 feature that minpac leverages is the job control feature. This allows minpac to install and update plugins in parallel.
Configuring minpac
So for me, coming from pathogen, I can delete the ~/.vim/bundle
directory and create the directory where minpac will live.
rm -rf ~/.vim/bundle
mkdir -p ~/.vim/pack/minpac/opt
git clone https://github.com/k-takata/minpac.git ~/.vim/pack/minpac/opt/minpac
From here, it's a matter of configuring your .vimrc
for minpac. The following is a basic example of what you might include in your .vimrc
. Minpac's install instructions offer something more simple than this but I like this example because it offers the ability to have a more flexible .vimrc
for the case where you want to use the same .vimrc
in different environments (like on a server that doesn't have your plugins installed).
" ~/.vimrc
" Try to load minpac.
packadd minpac
if !exists('g:loaded_minpac')
" minpac is not available.
" Settings for plugin-less environment.
" ...
else
" minpac is available.
" init with verbosity 3 to see minpac work
call minpac#init({'verbose': 3})
call minpac#add('k-takata/minpac', {'type': 'opt'})
" Additional plugins here.
call minpac#add('airblade/vim-gitgutter')
call minpac#add('altercation/vim-colors-solarized')
call minpac#add('itchyny/lightline.vim')
call minpac#add('prettier/vim-prettier')
call minpac#add('tpope/vim-commentary')
call minpac#add('tpope/vim-endwise')
call minpac#add('tpope/vim-fugitive')
call minpac#add('tpope/vim-repeat')
call minpac#add('tpope/vim-surround')
" ...
" minpac utility commands
command! PackUpdate call minpac#update()
command! PackClean call minpac#clean()
command! PackStatus call minpac#status()
" Plugin settings here.
" ...
endif
" Common settings here.
"...
Here's minpac in action. After I open vim, I update all plugins specified in my .vimrc
using the utility command :PackUpdate
. After the update is finished, :PackStatus
shows a summary of what changed.
Of course, minpac also works with Neovim if you prefer that over Vim 8. Check out the docs for a slightly different install process.
Happy Vim'ing! 🍻
Top comments (1)
Thank you! Helpful for me)