|
|
|
# Sourced for interactive shells
|
|
|
|
# Set up aliases, functions, options, key bindings, etc.
|
|
|
|
# Do not produce output
|
|
|
|
#
|
|
|
|
# +--------------------+-------+-------+--------+
|
|
|
|
# | | Inter | Inter | Script |
|
|
|
|
# | | Login | | |
|
|
|
|
# +====================+=======+=======+========+
|
|
|
|
# | /etc/zshenv | A | A | A |
|
|
|
|
# +--------------------+-------+-------+--------+
|
|
|
|
# | $ZDOTDIR/.zshenv | B | B | B |
|
|
|
|
# +--------------------+-------+-------+--------+
|
|
|
|
# | /etc/zprofile | C | | |
|
|
|
|
# +--------------------+-------+-------+--------+
|
|
|
|
# | $ZDOTDIR/.zprofile | D | | |
|
|
|
|
# +--------------------+-------+-------+--------+
|
|
|
|
# | /etc/zshrc | E | C | |
|
|
|
|
# +--------------------+-------+-------+--------+
|
|
|
|
# | $ZDOTDIR/.zshrc | F | D | |
|
|
|
|
# +--------------------+-------+-------+--------+
|
|
|
|
# | /etc/zlogin | G | | |
|
|
|
|
# +--------------------+-------+-------+--------+
|
|
|
|
# | $ZDOTDIR/.zlogin | H | | |
|
|
|
|
# +--------------------+-------+-------+--------+
|
|
|
|
#
|
|
|
|
# http://zsh.sourceforge.net
|
|
|
|
|
|
|
|
# Source Prezto.
|
|
|
|
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
|
|
|
|
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
|
|
|
|
else
|
|
|
|
# Setup Prompt
|
|
|
|
declare PS1='%(!,%S%F{red},%F{green})%m:%!(%L)%#%(!,%s%f,%f) '
|
|
|
|
#declare PS1="\[\033[1;30m\][\[\033[1;34m\]\$(date +%H:%M) \u\[\033[1;30m\]@\[\033[0;35m\]\h\[\033[1;30m\]] \[\033[0;37m\]\W \[\033[1;30m\]\$\[\033[0m\] "
|
|
|
|
#PS1=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%}
|
|
|
|
#%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B]%{\e[0m%}%b '
|
|
|
|
declare RPS1='%DT%*'
|
|
|
|
fi
|
|
|
|
|
|
|
|
setopt histsubstpattern
|
|
|
|
setopt vi
|
|
|
|
|
|
|
|
# General Settings
|
|
|
|
declare -x CALENDAR_DIR="/usr/share/calendar"
|
|
|
|
declare HISTFILESIZE='50'
|
|
|
|
declare HISTSIZE='50'
|
|
|
|
|
|
|
|
#aliases
|
|
|
|
alias c="clear; clear; dirs"
|
|
|
|
alias ls="ls -FGh"
|
|
|
|
alias su="su -m"
|
|
|
|
alias ping="ping -c 4"
|
|
|
|
alias sed="sed -E"
|
|
|
|
alias grep="grep -anHE --color --exclude-dir=\.git --exclude-dir=\.hg --exclude-dir=\.svn --exclude-dir=build --exclude-dir=dist --exclude=tags"
|
|
|
|
|
|
|
|
if [ "$ZSH_VERSION" ]; then
|
|
|
|
autoload -U compinit
|
|
|
|
compinit
|
|
|
|
|
|
|
|
# cd hook
|
|
|
|
autoload -U add-zsh-hook
|
|
|
|
|
|
|
|
title-bar() {
|
|
|
|
[[ -t 1 ]] || return
|
|
|
|
case $TERM in
|
|
|
|
sun-cmd)
|
|
|
|
print -Pn "\e]l%~\e\\"
|
|
|
|
;;
|
|
|
|
*xterm*|rxvt|(dt|k|E)term)
|
|
|
|
print -Pn "\e]1;%~\a"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
add-zsh-hook precmd title-bar
|
|
|
|
|
|
|
|
load-local-conf() {
|
|
|
|
# check file exists, is regular file and is readable:
|
|
|
|
if [[ -f .sh_source && -r .sh_source ]]; then
|
|
|
|
source .sh_source
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
add-zsh-hook chpwd load-local-conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Setup by operating system type
|
|
|
|
case `/usr/bin/uname -s` in
|
|
|
|
Darwin)
|
|
|
|
alias psql_start="sudo -u _postgres /opt/local/bin/pg_ctl -D /opt/local/var/db/pgsql/data start"
|
|
|
|
alias psql_stop="sudo -u _postgres /opt/local/bin/pg_ctl -D /opt/local/var/db/pgsql/data stop"
|
|
|
|
;;
|
|
|
|
|
|
|
|
linux*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Setup by processor type
|
|
|
|
case `/usr/bin/uname -m` in
|
|
|
|
powerpc)
|
|
|
|
;;
|
|
|
|
|
|
|
|
i386)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Setup by host name
|
|
|
|
case `/usr/bin/uname -n` in
|
|
|
|
helsten)
|
|
|
|
;;
|
|
|
|
|
|
|
|
pfiefferhorn)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Setup by subsystem
|
|
|
|
for f in `find $HOME/Library/Scripts/config -name '*.shrc'`; do
|
|
|
|
source "$f"
|
|
|
|
done
|
|
|
|
|