This is not a direct answer to the question, but I think is still a reasonable solution.
The way I handle this is I have several .vimrc files:
vimrc-all - All common things
vimrc-win - Windows configuration
vimrc-linux - Linux configuration
vimrc-workMachine - Things specific to my work machine
vimrc-homeMachine - Things specific to my home machine
On my workMachine, I create a symlink from ~/.vimrc to ~/dotfiles/vimConfig/vimrc-workMachine.
This is what my vimrc-workMachine looks like:
" ======================================
" Source general vim config
" ======================================
source ~/dotfiles/vimConfig/vimrc-all.vim
source ~/dotfiles/vimConfig/vimrc-linux.vim
" ======================================
" All other stuff
" ======================================
.vimrcdoesn't have to "know" anything about which machine it is on; and, you would never touch your.vimrcfile directly ever again, except to update all of them together, avoiding the chance to accidentally get them out of sync. – jpaugh May 07 '16 at 01:27