Plugins configuration file for Vim

Plugins configuration file for Vim

I'm quite new to Vim, and, since I'm writing my very own .vimrc file, I was wondering if there is a way to store all the commands relative to a certain plugin configuration in one external file, in order to make the original .vimrc file less dense, and how can I call that file in my .vimrc file. Any help will be appreciated.

EDIT: I forgot to say that I'm currently using Pathogen as plugin manager.

答案1

You can separate settings for plugins in several files, and include them in .vimrc

For example:

" My Plugin settings {
if filereadable(expand('~/.vim/my.plugin.settings.vim'))
  source ~/.vim/my.plugin.settings.vim
endif
" }

答案2

If Pathogen is not registering plugins before $HOME/.vim (which is extremely unlikely), you could simply drop your configuration file into $HOME/.vim/plugin/. That's all. No need to test anything (*), nor to be explicit. IOW: no need to write anything in your .vimrc to configure your plugins if you use a plugin manager.

(*) Actually, there is really no need to test anything: :runtime my.plugin.settings.vim wouldn't have barked at you if the file wasn't there, and it would have sourced if it were.

相关内容