# Franklin M. Siler # .zshrc / .bashrc / .bash_profile # # many years old, actually worked on 7/14/2004 # for sh-compatible shells. # # 20050712: bunches of new stuff: completion and fixed ls aliases umask 002 # OS X hacks if [[ `uname` == 'Darwin' ]] then # make X stuff work if started from Terminal if [[ -z "$DISPLAY" ]] then export DISPLAY=':0.0' fi alias top='TERM=vt100 top -o cpu' fi # FreeBSD Hacks if [[ "$TERM" == 'ansi' && `uname` == 'FreeBSD' ]] then # FreeBSD thinks ansi is really stupid. Of course it's not :P export TERM=vt100-co fi # # shell-specific operations # # TODO: more shell-specific hacks # bash if expr "$-" : '.*B' > /dev/null then export PS1="\[\033[01;32m\]\u@\h \[\033[01;34m\]\w$\[\033[00m\] " # zsh elif expr "$-" : '.*Z' > /dev/null then # that's a lotta stuff for a prompt fg_default=$'\e[0;39m' fg_red=$'\e[1;31m' fg_green=$'\e[1;32m' fg_yellow=$'\e[1;33m' fg_blue=$'\e[1;34m' export PS1="[%{%(!.${fg_red}.${fg_green})%}%n@%m%{${fg_default}%}] \ %{$fg_blue%}%~%{$fg_default%}:%{$fg_blue%}%l %{$fg_default%}:%# " unset fg_default fg_green fg_blue fg_yellow fg_red # funny that as a vim user I miss the emacs keys when they don't work bindkey -e # make it so $PATH will only have unique entries typeset -U PATH MANPATH # zsh has neat stuff you can set export READNULLCMD='less' export REPORTTIME=60 export HISTFILE=~/.zhistory export SAVEHIST=2000 setopt sharehistory histignorealldups histreduceblanks setopt c_bases extended_history setopt noclobber chaselinks correct nohup setopt autocontinue 2>/dev/null # trying to get used to not pulling up python every time I need to do 57*62 autoload -U zcalc if expr $ZSH_VERSION : '4\.2.*' > /dev/null then zstyle ':completion:*' completer _expand _complete _correct _approximate zstyle :compinstall filename "$HOME/.zshrc" # Thanks Joey local _myhosts _myhosts=( ${${${${(f)"$(<$HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*} ) zstyle ':completion:*' hosts $_myhosts autoload -Uz compinit compinit fi fi ### various important globals # ssh -> rsh export CVS_RSH='ssh' export RSYNC_RSH='ssh' # ah yes, vim is very important, as is less export EDITOR='vim' export PAGER="`which less` -M" export TZ='America/Chicago' export BLOCKSIZE='M' # fink (OS X) if [[ -r /sw/bin/init.sh ]]; then . /sw/bin/init.sh; fi export PATH="$HOME/bin:/usr/local/bin:$PATH" export MANPATH="$MANPATH:/usr/local/man" ### aliases alias rsync='rsync --progress' ### set up ls appropriately ls -AG 2>&1 >/dev/null && alias ls='ls -AG' l='ls -lAG' ls -A --color=auto 2>&1 >/dev/null && alias ls='ls -A --color=auto' l='ls -lA --color=auto' ### stuff to execute at the very end if [[ -r ~/.hostrc ]]; then . ~/.hostrc; fi # I like fortune cookies if [[ -x `which fortune` ]]; then echo; fortune; echo; fi ### ssh key management host='LOCAL' # change for hosts with homedirs shared between machines keys=~/.ssh/id_dsa if [[ -x `which keychain` ]]; then keychain -Q -q --timeout 1440 --host $host $keys; fi if [[ -r ~/.keychain/$host-sh ]]; then source ~/.keychain/$host-sh; fi unset host keys