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
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#end() several times. Even when changing the directory of
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? Surely your plugin manager supports loading a function via a function call?
.local.vimfor 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.
vimrcwhich is not what I want. Now you suggest adding lines to a
local.vimrcwhich 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)
.vimrcfile, 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
.vimrcwould treat it the same way in each case. Finally, the main
.vimrcwould load the plugins mentioned in the list. Does that make sense?