From 486bbbcbb78ff022420640be59ebe72a24cb0882 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Fri, 5 Sep 2008 18:08:32 +0200 Subject: [PATCH] Added the possibility to automatically load configuration files. Also added rc.local and env.local with local settings. --- zsh/env | 10 ++++++++++ zsh/env.local | 14 ++++++++++++++ zsh/rc | 10 ++++++++++ zsh/rc.local | 16 ++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 zsh/env.local create mode 100644 zsh/rc.local diff --git a/zsh/env b/zsh/env index 7aecc74..269695e 100644 --- a/zsh/env +++ b/zsh/env @@ -14,3 +14,13 @@ export PAGER=less # page less automatically quits. Also allows the use with colordiff. export LESS="--no-init --search-skip-screen --quit-if-one-screen \ --RAW-CONTROL-CHARS" + + +# If an env.local file exists load it, otherwise load an env file for the +# current hostname (first part before a dot) if it exists. +host=${$(hostname)//.*/} +if [[ -f ~/.zsh/env.local ]]; then; + source ~/.zsh/env.local +elif [[ -f ~/.zsh/env.$host ]]; then; + source ~/.zsh/env.$host +fi diff --git a/zsh/env.local b/zsh/env.local new file mode 100644 index 0000000..a3cdc6a --- /dev/null +++ b/zsh/env.local @@ -0,0 +1,14 @@ +# Zsh configuration file for environment related options for my local computer. + + +# Path to my local "unix" directory where my scripts, configuration files and +# other unix related data is stored. +MYUNIX=~/Documents/unix + +# Add my bin/ directory, macports bin/ and sbin/ and the X11 bin/ directory to +# the default PATH. +typeset -U path +path=($MYUNIX/bin /opt/local/bin /opt/local/sbin $path /usr/X11R6/bin) + +# Necessary for xterm to find man pages through PATH. +unset MANPATH diff --git a/zsh/rc b/zsh/rc index 298cab3..b7c4f00 100644 --- a/zsh/rc +++ b/zsh/rc @@ -53,3 +53,13 @@ zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # Enable zsh's extended glob abilities. setopt extendedglob + + +# If a rc.local file exists load it, otherwise load a rc file for the current +# hostname (first part before a dot) if it exists. +host=${$(hostname)//.*/} +if [[ -f ~/.zsh/rc.local ]]; then; + source ~/.zsh/rc.local +elif [[ -f ~/.zsh/rc.$host ]]; then; + source ~/.zsh/rc.$host +fi diff --git a/zsh/rc.local b/zsh/rc.local new file mode 100644 index 0000000..733ada1 --- /dev/null +++ b/zsh/rc.local @@ -0,0 +1,16 @@ +# Zsh configuration file for my local computer. + + +# Shortcuts for the prompt and to cd to important directories. +unix=~/Documents/unix +macports=${unix}/macports +htdocs=/Library/WebServer/Documents +page=${htdocs}/page +# Activate these shortcuts. +: ~unix ~macports ~htdocs ~page + +# Aliases for easy and fast cd to important directories. +alias cdu='cd ~unix' +alias cdm='cd ~macports' +alias cdh='cd ~htdocs' +alias cdp='cd ~page' -- 2.44.1