I have my dotfiles synchronized on github which is a current practice.
As I use several machines I want to be able to have some part of my configuration not synched on my github repo. To do so I added these lines in my synched .vimrc
:
let $MYLOCALVIMRC = $HOME . "/.local.vim"
if filereadable($MYLOCALVIMRC)
source $MYLOCALVIMRC
endif
Which allows me to add some configuration to ~/.local.vim
which isn't synched.
This works well but now I'd like to extend that to the plugins: I'd like to have some plugins only loaded on some machines.
I'm using vim-plug as my plugin manager and it is not possible to call plug#begin('~/.vim/plugged')
and plug#end()
several times. Even when changing the directory of plug#begin()
.
The only solution I could imagine was to use a second plugin manager for the local vimrc but it is pretty ugly and I think that it might create some conflicts on the runtime path.
TL;DR Is it possible, using a plugin manager, to load some plugins in a .vimrc
file and some other plugins in a local configuration file sourced by the first .vimrc
?
.vimrc
? Surely your plugin manager supports loading a function via a function call?.local.vim
for each machine? You could add to the plugins list in the local file, then load them all in the main.vimrc
. Creating the plugin list, and loading all plugins would happen in the.vimrc
, but running the local script in between would give it the chance to modify the list of plugins.vimrc
which is not what I want. Now you suggest adding lines to alocal.vimrc
which is indeed what I want and what the solution of VanLaser says. I also don't understand what you mean with the for loop (I know what a for loop is but I don't understand what you want to do with it).vimrc
file, the call the machine-local script, then that script can add whatever it want to that list. Each local script could add something different, and the.vimrc
would treat it the same way in each case. Finally, the main.vimrc
would load the plugins mentioned in the list. Does that make sense?