Code Yarns β€πŸ‘¨β€πŸ’»
Tech Blog ❖ Personal Blog

Using vim-addon-manager on Windows

πŸ“… 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.

  1. Curl: vim-addon-manager uses Curl to download files from the web.
* Install a Windows binary of Curl and remember to add the curl.exe directory to the `PATH` environment variable.
  1. 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.
* Install 7-Zip if you do not already have it. Add the 7z.exe directory to the `PATH` environment variable.
  1. 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.)
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.
  1. 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

  1. 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%.

  2. Open a command prompt in vim-addons and install vim-addon-manager here using:

$ git clone git://github.com/MarcWeber/vim-addon-manager.git
  1. 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

Notes


Β© 2023 Ashwin Nanjappa β€’ All writing under CC BY-SA license β€’ 🐘 @codeyarns@hachyderm.io β€’ πŸ“§