模块化vimrc:如何从不同的文件中获取vundle插件
我想把我的vimrc分解成不同的组件。我用Vundle管理我的vim插件,我希望每个插件有一个文件,告诉Vundle管理它并设置如下配置: vundle.vim:模块化vimrc:如何从不同的文件中获取vundle插件,vim,plugins,modular,vundle,Vim,Plugins,Modular,Vundle,我想把我的vimrc分解成不同的组件。我用Vundle管理我的vim插件,我希望每个插件有一个文件,告诉Vundle管理它并设置如下配置: vundle.vim: set nocompatible filetype off set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() "Plugin in here: Plugin 'gmarik/Vundle.vim' call vundle#end() filetype plugin inden
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"Plugin in here:
Plugin 'gmarik/Vundle.vim'
call vundle#end()
filetype plugin indent on
"Plugin Options:
及
syntastic.vim:
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
"Plugin in here:
Plugin 'scrooloose/syntastic'
call vundle#end()
filetype plugin indent on
"Plugin Options:
" - Python:
let g:syntastic_python_checkers = ['pylint', 'flake8']
let g:syntastic_aggregate_errors = 1
等等
如果我现在称之为vimrc:
source vundle.vim
source syntastic.vim
只有最后一个插件显示在vundles插件列表中,但会读取其他配置。
我猜vundle仅在调用时调用“vundle#begin()”/“vundle#end()”部分(:PluginXXX),因此只返回上次源文件的内容。
我怎样才能解决这个问题?
我能用像这样的东西吗
PLUGINS = "Plugin gmarik/vundle"
PLUGINS = $PLUGINS + "Plugin scrooloose/syntastic"
...
打电话
vundle#begin()
$PLUGINS
vundle#end()
在我的vimrc里?
如果是,vim变量的语法是什么
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
runtime! config/*.vim
call vundle#end()
filetype plugin indent on
...
~/.vim/config/syntastic.vim
Plugin 'scrooloose/syntastic'
let g:syntastic_python_checkers = ['pylint', 'flake8']
let g:syntastic_aggregate_errors = 1
...
等等。但是,为了零收益,我做了大量的工作。我最后得出以下结论:
set nocompatible
filetype off
set rtp+=~/.nvim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'rking/ag.vim'
...
call vundle#end()
filetype plugin indent on
runtime! vundle/*.vim
这意味着我获得了vundle#begin()
和vundle#end()
的性能,以及在各自的文件中为每个插件设置的模块性。这种设置提供了一个意想不到的优势,即需要管理的插件文件更少,即插件
一行程序。现在,我仅有的插件,.vim文件是带有附加配置的
这种设置的缺点是我必须从两个地方删除插件
优点是:性能提高;您仍然有相当模块化的插件设置,使它们更易于添加和删除。我认为这行不通。可以使用vundle#rc(),但要以性能为代价。好处是模块化使插件更易于管理,即添加或删除。更多细节请参见我的答案。