Instead of calling execute pathogen#infect()
to load all plugins, call pathogen#interpose
for every plugin, i.e.:
execute pathogen#interpose('bundle/unicode.vim')
execute pathogen#interpose('bundle/AnsiEsc.vim')
The pathogen API isn't documented outside of the source, but it's simple enough (even though the function names are obscure and non-descriptive). You can also use pathogen#surround()
for absolute paths.
You can load plugins conditionally with a basic autocmd
:
" Always use this plugin
execute pathogen#interpose('bundle/unicode.vim')
" Only for Python
autocmd FileType python execute pathogen#interpose('bundle/vim-sexp')
If you find you have many of these cases, you could even split it up into different paths:
~/.vim/bundle/always
for plugins you always want
~/.vim/bundle/<filetype>
for plugins for a specific filetype
And then load it like so:
" Always use this plugin
execute pathogen#infect('bundle/always/{}')
" Load filetype plugins if they exist
autocmd FileType * if isdirectory('/home/martin/.vim/bundle/' . &ft) | execute pathogen#infect('bundle/' . &ft. '/{}') | endif
This way you don't have to add a whole bunch of autocmd
s for every filetype/plugin.
if this does exist, does :set syntax whatever
switch the plugins? Because that would be super :)
Once a plugin is loaded, it's loaded. A "plugin" is simply a collection of function
, command
, and map
definitons. I don't know of any straightforward way to "unload' this.
It does load plugins for a filetype iff you use :set filetype
; In general, you always want to use :set filetype
and not :set syntax
, as syntax
will only set the syntax highlighting, and not the indentation and other settings (e.g. iskeyword
, formatexpr
, etc.).