- 0 Talk
-
How do you install Vim plugins?
In general:
- Place plugin files in the appropriate directory for the type of plugin.
- From within Vim, run the :helptags command on the documentation directory.
The "appropriate directory" will depend on the type of plugin, but should almost always be a subdirectory of ~/.vim on Unix-like systems, or $HOME/vimfiles on Windows systems (where the value of $HOME can easily be found with ":echo $HOME" within Vim). Some plugins provide archives including the proper directory structure, others are packaged in a "vimball" format that can simply be installed by running :source on the file, but if you need to find the appropriate directory yourself, here are the basics:
- The "plugin" directory is for plugins that should always be loaded whenever Vim starts. These define global commands, interface tweaks, or new functionality useful for all or many file types.
- The "ftplugin" directory is for filetype-specific plugins, such as autocompletion or highlight-errors-as-you-edit plugins.
- The "syntax" directory is for updated syntax highlighting rules specific to a file type.
- The "indent" directory is for filetype-specific indentation rules.
- The "ftdetect" directory is for filetype-detection rules. Files that go here should usually do nothing but set the filetype so that files in the ftplugin, indent, or syntax directories are loaded for a new filetype.
- The "colors" directory is for color scheme files.
- The "doc" directory is for any help file documentation.
- The "after" directory contains another tree with directories like "plugin", "ftplugin", and "syntax" that can be used to override settings in the system-wide settings or other plugins placed in the normal version of these directories. These files will always be loaded after their counterparts in other directories.