Splitting zsh config due multi host usage

This week while copying some of my dotfiles (due vim and zsh configuration) to a new remote host (dedicated server) of a new client I had to remove the private stuff (mainly aliases) from my .zshrc. Only now did the muse hit me to split the file and leverage the source (import, require, include) functionality.

So I moved the host specific and private stuff from .zshrc and added the following 2 lines after source $ZSH/oh-my-zsh.sh:

[[ -f .zshrc_priv ]] && source .zshrc_priv
[[ -f .zshrc_host ]] && source .zshrc_host

After editing .zshrc and moving some lines into .zshrc_priv and .zshrc_host I also commented the files header to be reminded about their purpose in the future 😀

# .zshrc_priv
# Sourced by .zshrc
# Private settings due public version control

alias vps='TERM=xterm-256color autossh -M 0 mike@vps' # host vps set in .ssh/config
alias vps_tunnel='autossh -f -M 0 -T -N -R 10022:localhost:22 mike@vps'
# .zshrc_host
# Sourced by .zshrc
# Host specific settings

export PATH="/usr/local/opt/node@6/bin:$PATH

Next I gonna separate some vim plugin specific code, too, to have a copyable (Plug & Play) config.

Advertisements

Author: Michal Zuber

Full stack developer, biker and rollerblader. Owner and developer at https://nevilleweb.sk/ Co-founded http://neville.sk/ Blog at https://michalzuber.wordpress.com/

2 thoughts on “Splitting zsh config due multi host usage”

Leave a Reply to Michal Zuber Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s