我想把我的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变量的语法是什么?
发布于 2014-09-14 07:23:18
~/.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
...诸若此类。但这是我所做的大量工作,却没有带来任何好处。
发布于 2016-01-20 18:27:01
我最终得到了这个:
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,文件就是那些有额外配置的插件。
这种设置的缺点是我必须从两个地方删除插件。
优点是:提高了性能;你仍然有相当模块化的插件设置,使它们更容易添加和删除。
https://stackoverflow.com/questions/25827839
复制相似问题