0

I want to break down my vimrc in diffrent components. I manage my vim Plugins with Vundle and I want to have one file per plugin that tells vundle to manage it and to set configuration like this:

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:

and 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 

and so on.

If I now call this vimrc:

source vundle.vim
source syntastic.vim

only the last Plugin shows up in vundles Plugin list, other configurations are read though. I guess, vundle calls the 'vundle#begin()'/'vundle#end()' part only upon call (:PluginXXX) and therefore only returns the content of the file last sourced. How can I solve this problem? Can I use something like

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

and call

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

in my vimrc? If so, what is the syntax for vim variables?

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

And so on. But that's IMO a lot of work for zero benefit.

Sign up to request clarification or add additional context in comments.

2 Comments

I don't think this will work - github.com/VundleVim/Vundle.vim/issues/119. Can use vundle#rc() but at the cost of performance.
The benefit is modularity makes plugins easier to managed, i.e., add or remove. See my answer for more details.
0

I ended up with this:

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

Which means I get the performance of vundle#begin() and vundle#end() combined with the modularity of having settings for each plugin in their own file. This setup gave the unexpected advantage of having less plugin files to manage, i.e., the Plugin one-liners. Now the only plugin, .vim, files I have are the ones with additional configuration.

The disadvantage of this setup is I have to remove the plugin from two places.

The advantages are: increased performance; you still have fairly modular plugin settings, making them easier to add and remove.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.