I have a custom .vimrc file which I use across many different machines.
Some machines are less powerful than others, and it would be nice to be able to load a "stripped-down" version of the .vimrc file. However, I'd like to maintain a single .vimrc to avoid fragmentation.
Ideally, I'd like to pass arguments to my .vimrc from the command line. If the "minimal" option is selected, the .vimrc would skip over loading the most resource-intensive plugins.
Does anyone know the best/cleanest way to do this?
Thanks!
Edit: The slower machine I'm talking about is a Raspberry Pi over SSH. Vim itself isn't slow, although I have several plugins including NERDTree and Syntastic that take lots of time to load on the Pi's limited CPU. By taking out most plugins for my "minimal" configuration, I cut down the loading time from 3.5 seconds to 0.5 seconds.
You can use the --cmd
switch to execute a command before any VIMRC is loaded.
So on your less powerful machines you could alias vim
to something like vim --cmd 'let weak=1'
and then in your $VIMRC
you can say:
if exists('weak')
echo "poor machine"
endif
take a look at source:
source /foo/bar/another_vimrc
Your 'heavy' vimrc can just source the basic vimrc and add what you want. This is also really handy for project/machine specific abbreviations, ctags, etc.
This will not keep a single vimrc file, but for the sake of others who have the same question (as stated at the top of the page):
$ vim -u ~/.vim-min.vim
Note that this will suppress loading both the system vimrc file (if any) and your personal vimrc file.
:help -u
:help startup
(See Step 3 of the second reference.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With