You can surround the config/code in question with a conditional based on an environment variable.
If you're using Bash environments a good candidate is envvar HOSTNAME
which will probably be unique (in a personal context, at least). In other environments there is usually a way to get this same information (e.g. output of the *nix command hostname
or envvar COMPUTERNAME
on Windows). If you have a heterogeneous mix of machines then the best approach is probably to use the Vim function hostname()
which provides a platform agnostic means of getting the information.1
For simplicity, we'll pretend we're all in on Bash. :) For the example you mentioned we'd just need to add something like...
if $HOSTNAME == "foo"
au! redhat BufReadPost ...
endif
Of course, we can also extend this to multiple hosts and/or have default settings...
if $HOSTNAME == "foo"
" this config
elseif $HOSTNAME == "bar"
" that config
else
" default config
endif
Before you set it up check availability with :echo $HOSTNAME
.
If you want to look for alternatives you could run :!printenv
or :!env
or whatever your system's equivalent command is. In the unlikely event that you can't find an existing envvar that will work then make something up! Choose a variable name not currently in use and on the machine(s) you want to isolate put (assuming Bash, again) export MYSPECIALVAR=uniquevalue
in your .profile, .bash_profile, .bashrc or whatever makes the most sense for your environment.
1Thanks to @Achilleas for spurring me to expand/improve this section.