I am a big fan of the Vim editor for many years. However installing, updating and removing Vim plugins require a great deal of time and effort. In this article I would like to introduce a couple of tools, which makes the whole process a breeze. The basic idea is instead of copying plugin files to different directories, just leave them where they are and load them when Vim starts. To remove a plugin, simply delete the corresponding subdirectory.
- Vim Editor Version 7.0 or higher(Some plugins won’t work with older vim versions)
The last two applications are part of the xCode bundle.
- Before we start, it is probably a good idea to create a backup of the old plugins.
Backup the .vimrc filecp .vimrc .vimrc_backup
- Backup the .vim folder
mv .vim .vim_backup
- Create “bundle” subfolder within .vim folder.
mkdir -p .vim/bundle
(This is where all the plugin directories will be copied)
- Download the pathogen plugin from https://github.com/tpope/vim-pathogen/
(navigate to .vim directory)git clone git://github.com/tpope/vim-pathogen.git
(This will download the latest pathogen plugin)cp -r ~/.vim/vim-pathogen/autoload ~/.vim/
(This will copy the autoload directory to .vim folder)
- To load pathogen when vim starts, add the following lines in .vimrc
filetype plugin indent on
- Remove the vim-pathogen folder.
rm -rf ~/.vim/vim-pathogen
(remove the empty folder)
- The next step is to download all your favourite plugins into the bundle directory and keep them sync with the latest updates. The Ruby script written by Tammer Saleh comes in handy for this purpose. Once you customize the script by including all the plugins you want to use, all you have to do is to run the script in regular intervals.
- Download the latest Ruby script to .vim directory.
The modified ruby script can be downloaded here.
- Open the script and activate your favourite plugins. You can also add new plugins from git, mercurial repositories or even zipped bundles from Vim.org. Once you are ready with the activated collection save the script and run to install.
You can find my own vim setup on GitHub. Download the complete package and customize it as necessary. Please read the README for installation instructions.
- Tim Pope’s pathogen: http://www.vim.org/scripts/script.php?script_id=2332
- Ruby script(Tammer Saleh): https://gist.github.com/593551