Vimbower
Use bower, git and pathogen to manage your vim setup
Install / Use
/learn @rstacruz/VimbowerREADME
Deprecated: As Bower isn't maintained regularly anymore, I suggest using another Vim package management suite. Consider vim-plug.
vimbower
You can use bower, pathogen and git to manage your vim dependencies.
Bower is a package manager for frontend projects. It doesn't really care what's in a package, it just happens to be used for JS and CSS most of the time. In reality, it's a package manager for anything.
Pathogen is a small vim plugin to load vim plugins from ~/.vim/bundle/.
Vim plugins are typically published in GitHub. Bower fetches from GitHub. Perfect.
Here's how you can use Bower to manage your ~/.vim/bundle.
Get started
Just configure Bower to manage ~/.vim/bundle, and set up Pathogen. For those already familiar with these tools:
cd ~/.vim
npm install -g bower # install bower via npm
echo '{"directory":"bundle"}' > .bowerrc # make bower put plugins in bundle/
echo "bundle/" >> .gitignore # don't commit bundles
bower init # create bower.json
bower install --save tpope/vim-pathogen # install pathogen
And add Pathogen to vimrc:
" ~/.vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
Set up git, and that's pretty much it. Confused? Read the step-by-step guide below.
:zap: Getting started ▸
<br>Working on your setup
You can use bower to add, remove and update packages.
# add/remove packages
bower install --save tpope/vim-sensible
bower install --save scrooloose/nerdtree#master
bower uninstall --save vim-haml
# fetch new versions
bower update
:zap: Maintenance ▸
<br>Advantages over alternatives
There's neobundle and vundle too. Using bower would have a few advantages:
-
More friendly towards local development:<br> Using the bower link command, you can keep development versions anywhere and have bower manage the symlinks.
-
No git submodules:<br> Submodules can get very slow (try doing git status in repo with 30 submodules), messy, and quite ambiguous in things like handling updates.
-
Use versions other than 'master':<br> For plugins that may be unstable, bower can be set to fetch from a given tag or branch. This is especially great for plugins that follow semver conventions (eg: vim-css3-syntax).
-
Eventually, version locking:<br> Once bower implements shrinkwrapping (like npm), it'd be possible to lock the exact versions of your dependencies. In the mean time, there's this script.
Deploying to a different system
Assuming your setup is managed via Git, you can just clone your repo into ~/.vim. You can then run bower install.
rm -rf ~/.vim # ...careful!
git clone https://github.com/rstacruz/vimfiles.git ~/.vim
ln -s ~/.vim/vimrc.vim ~/.vimrc
cd ~/.vim
bower install
<br>
Caveats
- No easy way to lock versions until Bower implements shrinkwrapping.
- You'll need bower on the system you want to deploy to.
Until bower#505 is resolved in Bower 2.0, these caveats are mitigated by a simple script: here
<br>Examples
Security Score
Audited on Jan 9, 2024
