1

Programming with VIM requires several plugins for most modern projects, especially when dealing large code bases.

To this end:

  • Is there a fully automated VIM environment manager, which allows you to deploy pathogen based VIM environments, on any machine, without any manual work? If not..

  • Are there any good idioms for doing this which are commonly used and which can be efficiently borrowed?

Rationale: I have lots of VIM customizations. Is there a way to sync VIM setups between machines that is elegant and well supported?

  • Current Alternative: I tend to use a crude cp -r based mechanism which always manages to get out of sync.
jayunit100
  • 17,388
  • 22
  • 92
  • 167

1 Answers1

3

Commit your entire ~/.vim directory and ~/.vimrc to a git repository (as well as your .bashrc, etc). This is the correct and desired way to make your bash and Vim setup portable. The full setup is a folder in your home directory like ~/dotfiles with symlinks to your home dir for files and folders like .vim/. As in ~/.vim/ is a symlink to ~/dotfiles/.vim.

When you add a plugin to ~/.vim/bundle/, remove its .git/ folder otherwise git thinks the plugin directory is a submodule and it won't commit.

On a new machine, clone the repository into your home directory, so you'll have something like ~/dotfiles. Then symlink the appropriate files to your home directory, as in ln -s ~/.vimrc ~/dotfiles/.vimrc.

Here's an example of my config setup which has all of the above. I have a script in the directory I run that automatically symlinks all files starting with . to the home directory.

To upgrade a plugin, simply rm -rf the plugin directory in ~/.vim/bundle/ clone the plugin repo again into ~/.vim/bundle/, then cd into the new cloned folder and rm -rf the .git/ folder again, then git add pluginName and commit the updated plugin source to your dotfiles repo.

This is a desirable setup because the Vim plugin ecosystem is overwhelmingly terrible. You'll often have to dive into plugin source code yourself and modify lines by hand. If you already have all of your plugins committed to one repo, it's very easy to update their sources and commit to your portable dotfiles repo. Otherwise you'd have to fork every single plugin you modify by hand and maintain the fork, or submit a pull request to the original repository and wait for it to be merged.

Andy Ray
  • 30,372
  • 14
  • 101
  • 138