π 2010-Dec-09 ⬩ βοΈ Ashwin Nanjappa ⬩ π·οΈ plugins, vim ⬩ π Archive
vim-addon-manager is a Vim plugin written by Marc Weber that can be used to automatically manage Vim plugins. Most popular plugins install many files into several directories, thus making the task of installing, updating and uninstalling them quite tedious. vim-addon-manager attempts to make these tasks easy and automatic. It is still a work-in-progress, especially so on Windows, on which I found it to be quite flaky.
Before Installation
vim-addon-manager automatically pulls off plugins from the Internet both for installation and for updating. So, it requires a set of tools to be installed on Windows before it can be used.
* Install a Windows binary of Curl and remember to add the curl.exe directory to the `PATH` environment variable.
* Install 7-Zip if you do not already have it. Add the 7z.exe directory to the `PATH` environment variable.
1. Currently, there are 2 versions of Git for Windows available. I prefer to install the **[MsysGit](http://code.google.com/p/msysgit/)** version. During its installation, make sure to choose the option _Run Git from the Windows Command Prompt_.
2. The MsysGit installer should have added the Git\cmd directory to the `PATH` environment variable. Add it to `PATH` if this is not the case.
We are now ready to install vim-addon-manager! π
Installation
vim-addon-manager will store its own files and the files of all the plugins it will handle in one directory. %USERPROFILE%
on Windows is a good place to host such a directory. %USERPROFILE%
on Windows 7 resolves to C:\Users\Joe
. Create a directory named vim-addons in %USERPROFILE%
.
Open a command prompt in vim-addons and install vim-addon-manager here using:
$ git clone git://github.com/MarcWeber/vim-addon-manager.git
"-------------------------------------------------------------------------------
" Vim Addon Manager
fun LoadVimAddonManager()
" Load vim-addon-manager
set runtimepath+=$USERPROFILE/vim-addons/vim-addon-manager
" Install/load these plugins
call scriptmanager#Activate( [ "vim_plugin_1", "vim_plugin_2" ] )
endf
" Activate the manager after Vim startup
au VimEnter * call LoadVimAddonManager()
"-------------------------------------------------------------------------------
The first time you run vim-addon-manager it will load another plugin named vim-addon-manager-known-repositories. This plugin is used as a database of all Vim plugin names and URLs to obtain them from. After this, vim-addon-manager will try to install the plugins listed in scriptmanager#Activate()
.
Usage
To install a new plugin, just add its name to the list in the call to scriptmanager#Activate()
. It will installed the next time Vim is executed.
All the existing plugins listed in the call to scriptmanager#Activate()
are loaded at runtime everytime a new Vim instance is invoked.
To update all the installed plugins from the web use the command :UpdateAddons
To uninstalla plugin:
Open vimrc and remove the plugin name from the list in scriptmanager#Activate()
. This means that it will not be loaded at runtime. However, the plugin files are still present on the harddisk.
To remove the plugin files, close all Vim instances, open a new Vim window and invoke :UninstallNotLoadedAddons the_plugin_name
Notes
vim-addon-manager relies heavily on being able to handle inputs of paths and output paths to other tools it invokes. So, it breaks down if you have shellslash enabled in your vimrc. Remove any :set shellslash
in your setup files.
I found that invoking scriptmanager#Activate()
directly in vimrc at startup does not work. It only works properly if invoked after all the Vim setup is complete. Mark Weber suggests using the event GUIEnter
to trigger scriptmanager#Activate()
. I found that this breaks down since the input function does not work this early in the Vim startup. The VimEnter
event seems to work fine for me, so I use it to trigger scriptmanager#Activate()
.
If you want to a simpler plugin to only manage each installed plugin in their subdirectory, check out Pathogen.