📅 2010-Dec-09 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ plugins, vim, vim-addon-manager, windows 7 ⬩ 📚 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.
Curl: vim-addon-manager uses Curl to download files from the web.
PATH
environment variable.7-Zip: Many Vim plugins are packaged as .gz or .bz2 files. vim-addon-manager requires a tool to uncompress these files. I prefer to use the awesome 7-Zip tool for this purpose.
PATH
environment variable.Git: A lot of Vim plugins are hosted on GitHub and other public Git repositories. A Git installation is convenient since vim-addon-manager itself is hosted on GitHub. (If you do not want to install Git, zip files of vim-addon-manager are available from GitHub. See Marc Weber's comment below.)
Currently, there are 2 versions of Git for Windows available. I prefer to install the MsysGit version. During its installation, make sure to choose the option Run Git from the Windows Command Prompt.
The MsysGit installer should have added the Gitdirectory to the PATH
environment variable. Add it to PATH
if this is not the case.
Hg or SVN: A few Vim plugins are hosted on Sourceforge, Bitbucket and other public repositories that use Mercurial or Subversion. If the plugin you use is hosted on such a service, install Hg or SVN binaries for Windows and add their directories to the PATH environment variable.
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
Open your vimrc and add these lines: ``` "-------------------------------------------------------------------------------
" 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.