What is the ~/.vim
file used for, if anything, other than plugins? Is it part of Vim, or was it "invented" by plugin managers like Vundle?
2 Answers
I don't have conclusive evidence, but:
.vim
is one of the default values of'runtimepath'
:'runtimepath' 'rtp' vimfiles 'runtimepath' 'rtp' string (default: Unix: "$HOME/.vim, $VIM/vimfiles, $VIMRUNTIME, $VIM/vimfiles/after, $HOME/.vim/after" ... This is a list of directories which will be searched for runtime files: filetype.vim filetypes by file name new-filetype scripts.vim filetypes by file contents new-filetype-scripts autoload/ automatically loaded scripts autoload-functions colors/ color scheme files :colorscheme compiler/ compiler files :compiler doc/ documentation write-local-help ftplugin/ filetype plugins write-filetype-plugin indent/ indent scripts indent-expression keymap/ key mapping files mbyte-keymap lang/ menu translations :menutrans menu.vim GUI menus menu.vim plugin/ plugin scripts write-plugin print/ files for printing postscript-print-encoding spell/ spell checking files spell syntax/ syntax files mysyntaxfile tutor/ files for vimtutor tutor
I think Pathogen was one of the first plugins to allow you to easily install plugins in other directories
Even its first release used
~/.vim
:" pathogen.vim - path option manipulation " Maintainer: Tim Pope " Last Change: Apr 26, 2008 " Install in ~/.vim/autoload (or ~\vimfiles\autoload). " " API is documented below. if exists("g:loaded_pathogen") || &cp finish
runtimepath
support was introduced in, or before, 2008. Fromversion6.txt
:*version6.txt* For Vim version 7.3. Last change: 2008 Aug 06 ... Plugin support *new-plugins* To make it really easy to load a Vim script when starting Vim, the "plugin" runtime directory can be used. All "*.vim" files in it will be automatically loaded. For Unix, the directory "~/.vim/plugin" is used by default. The 'runtimepath' option can be set to look in other directories for plugins. |load-plugins| |add-plugin| The |:runtime| command has been added to load one or more files in 'runtimepath'.
Vim 6.2 makes use of
runtimepath
, adding support for theftplugin
directory. See patch 6.2.073:*** ../vim-6.2.072/runtime/doc/filetype.txt Sun Jun 1 12:20:32 2003 --- runtime/doc/filetype.txt Thu Aug 14 11:22:30 2003 *************** *** 1,4 **** ! *filetype.txt* For Vim version 6.2. Last change: 2003 Apr 25 VIM REFERENCE MANUAL by Bram Moolenaar --- 1,4 ---- ! *filetype.txt* For Vim version 6.2. Last change: 2003 Aug 14 VIM REFERENCE MANUAL by Bram Moolenaar *************** *** 147,157 **** This means that the contents of compressed files are not inspected. *new-filetype* ! If a file type that you want to use is not detected yet, there are two ways to ! add it. In any way, it's better not modify the $VIMRUNTIME/filetype.vim file. ! It will be overwritten when installing a new version of Vim. ! A. If your file type can be detected by the file name. 1. Create your user runtime directory. You would normally use the first item of the 'runtimepath' option. Example for Unix: > :!mkdir ~/.vim
So, runtimepath
has been in use since at least 2003, well before Pathogen was released. We can safely conclude its invention predated Vundle and similar plugins. (Though it could have been invented by someone who wanted to make using plugins easier.) And its use was definitely making user-level extensions to functionality easier, by allowing one to drop files in various directories to easily affect Vim behaviour.
It's an optional part of Vim proper and predated the plugin managers. It can be used for plugins you write yourself, for plugins you get from others, and to augment or replace Vim's standard plugins. I didn't find a primary place in the documentation where its use is discussed, but you can find a number of examples by executing
:helpgrep /\.vim\>
It can also be used for your own filetype.vim
file to add the recognition of filetypes or filename suffixes not recognized by Vim's $VIMRUNTIME/filetype.vim
. Recent versions of Vim also look there for a file named vimrc
if ~/.vimrc
does not exist, allowing you to keep all your Vim configuration files in that directory.
-
-
2That's a good tip about
vimrc
. I might move mine in there to keep everything in one place. Oct 3, 2015 at 14:38 -
1@ssdecontrol definitely recommended. Makes keeping your stuff in version control easier.– muruOct 3, 2015 at 15:36
-
@muru I already have everything symlinked to a Git repo, but I like a clean home directory regardless. Oct 3, 2015 at 15:49