This is my .vim
directory, containing all my configurations for vim
and the
associated plugins I use.
Vim 7.4
Clone the repository:
git clone git://github.com/sds/.vim.git ~/.vim
If you following the [XDG Base Directory Specification][XDG] for organizing
your configuration files, you'll need to clone to repo into
$XDG_CONFIG_HOME/vim/vimrc
, and specify the VIMINIT
environment
variable so that the correct vimrc
is loaded (since Vim doesn't have
built-in support for XDG).
export VIMINIT='let $MYVIMRC="$XDG_CONFIG_HOME/vim/vimrc" | source $MYVIMRC'
[XDG]: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html)
Finally, run the update
script to get all the plugins:
cd ~/.vim && ./update
You can run the update
script at any time to fetch the latest changes from
each of the plugin repositories. If you have a lot of plugins and want to speed
this up, you could manually specify a revision of the plugin that you want, so
that it only updates when you change the revision.
Configuration files are broken up into various categories in the config
directory, including settings for individual plugins (if you're familiar with
the directory layout for vim
, config
replaces the plugin
directory).
The after
, autoload
, ftdetect
, ftplugin
, and indent
directories
act in the way vim
normally uses them. To summarize:
-
after
: Initialization to run "after"vim
has finished loading. Useful for defining shortcuts that override default key mappings. -
autoload
: Contains scripts which are "lazy-loaded". For example, when callingpathogen#infect()
,vim
looks for theinfect
function inautoload/pathogen.vim
. -
ftdetect
: Any scripts that are used to determine the type of a file. -
ftplugin
: Any plugins that are only run for a specific filetype. For example, ifvim
determines a file is of typehtml
, it will run the commands found inftplugin/html.vim
. -
indent
: The same asftplugin
, except specifically for setting up indent settings for specific filetypes.
The plugins.list
file contains the locations of the repositories for the
plugins. Plugins are stored in the bundles
directory, which is read by
Pathogen to load
all the plugins.
To remove a plugin, simply remove it from plugins.list
and run the
update
script.
When I was first exposed to using submodules for managing plugins with Pathogen, I found them clunky and annoying. For example, the documentation tag files would dirty the working tree, even though I didn't care that the tree of the submodule was dirty.
While better alternatives may exist (I believe you can ignore dirty trees in submodules from the containing repository with a recent version of git), I find the approach of explicitly listing your plugins in a file and running a script simpler and cleaner.