I'm confused about the order in which Vim loads plugin files, and seem to be finding mixed answers online. Some answers seem to suggest that vimrc is loaded before plugins, while others suggest that they are loaded during the sourcing of vimrc, at the line filetype plugin indent on
. Can someone please clarify the order in which vimrc, plugins, and plugins in the after/ directory are loaded, what causes each to load, and when each could be reloaded during a vim session (e.g. what happens when sourcing vimrc again, what happens when setting the filetype, etc.)?
Some answers seem to suggest that vimrc is loaded before plugins, while others suggest that they are loaded during the sourcing of vimrc, at the line filetype plugin indent on.
All plugins are sourced (the correct term) after your vimrc
unless you source them manually. The filetype plugin indent on
line doesn't change anything to that order.
Can someone please clarify the order in which vimrc, plugins, and plugins in the after/ directory are loaded,
Assuming you have filetype plugin indent on
in your vimrc
:
vimrc
if there is one.vimrc
.after/
directory.The whole thing is explained in :help startup
and can be seen very clearly with :scriptnames
.
what causes each to load,
The value of &runtimepath
in general and the :filetype
command for filetype-specific stuff.
and when each could be reloaded during a vim session (e.g. what happens when sourcing vimrc again, what happens when setting the filetype, etc.)?
:source $MYVIMRC
re-executes each command in your vimrc
.:help :filetype
.