0

我想在不同的组件中分解我的 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 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 仅在调用 (:PluginXXX) 时调用 'vundle#begin()'/'vundle#end()' 部分,因此仅返回最后获取的文件的内容。我怎么解决这个问题?我可以使用类似的东西吗

PLUGINS = "Plugin gmarik/vundle"
PLUGINS = $PLUGINS + "Plugin scrooloose/syntastic"
...

并打电话

vundle#begin()
$PLUGINS
vundle#end()

在我的 vimrc 中?如果是这样,vim 变量的语法是什么?

4

2 回答 2

1

~/.vimrc

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
...

等等。但这是 IMO 为实现零收益而做的大量工作。

于 2014-09-13T23:23:17.683 回答
0

我最终得到了这个:

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()结合了在自己的文件中为每个插件设置设置的模块化。这种设置带来了意想不到的优势,即需要管理的插件文件更少,即Plugin单行。现在,我拥有的唯一插件 .vim 文件是具有附加配置的文件。

这种设置的缺点是我必须从两个地方删除插件。

优点是:提高性能;你仍然有相当模块化的插件设置,使它们更容易添加和删除。

于 2016-01-20T10:27:01.420 回答