Mostly message printing updates; some other random stuff too

This commit is contained in:
Eryn Wells 2012-08-17 12:48:04 -07:00
parent 2bc2cf7b28
commit 7cf88c785e
3 changed files with 43 additions and 16 deletions

8
env
View file

@ -14,7 +14,7 @@ export SYS=`uname -s | tr A-Z a-z`
# Set this to a non-zero integer to see startup messages # Set this to a non-zero integer to see startup messages
export NOISY=0 export NOISY=0
print_info_noisy 1 "Initializing environment for $SYS system" print_info_noisy 1 'Initializing environment'
PAGER="less" PAGER="less"
MANPAGER=$PAGER MANPAGER=$PAGER
EDITOR="vim" EDITOR="vim"
@ -38,6 +38,7 @@ PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
export PATH export PATH
print_info_sub_noisy 2 "Setting up $SYS environment"
case $SYS in case $SYS in
darwin) darwin)
export PATH=$HOME/Library/Python/2.7/bin:$PATH export PATH=$HOME/Library/Python/2.7/bin:$PATH
@ -56,4 +57,7 @@ case $SYS in
esac esac
# Local environment settings # Local environment settings
[ -e $HOME/.env.local ] && source $HOME/.env.local if [ -e $HOME/.env.local ]; then
print_info_noisy 2 "Sourcing local environment setup"
source $HOME/.env.local
fi

7
rc
View file

@ -25,6 +25,7 @@ alias addkey="ssh-agent ~/.ssh/id_rsa"
alias pprint-json="python -c 'import sys,json;print json.dumps(json.load(sys.stdin), indent=2)'" alias pprint-json="python -c 'import sys,json;print json.dumps(json.load(sys.stdin), indent=2)'"
print_info_sub_noisy 2 "Sourcing ${SYS}-specific settings"
case $SYS in case $SYS in
darwin) darwin)
if binary_exists gls; then if binary_exists gls; then
@ -57,6 +58,7 @@ case $SYS in
esac esac
# Set up dircolors # Set up dircolors
print_info_sub_noisy 3 "Setting up dircolors"
if [ -e $HOME/.dircolors/$SYS.cfg ]; then if [ -e $HOME/.dircolors/$SYS.cfg ]; then
dircolors=$HOME/.dircolors/$SYS.cfg dircolors=$HOME/.dircolors/$SYS.cfg
else else
@ -72,4 +74,7 @@ export NETHACKOPTIONS="color"
[ -e "$HOME/Documents/Financial/personal.ledger" ] && \ [ -e "$HOME/Documents/Financial/personal.ledger" ] && \
LEDGER_FILE=$HOME/Documents/Financial/personal.ledger LEDGER_FILE=$HOME/Documents/Financial/personal.ledger
[ -e $HOME/.rc.local ] && source $HOME/.rc.local if [ -e $HOME/.rc.local ]; then
print_info_noisy 2 "Sourcing local settings for interactive shells"
source $HOME/.rc.local
fi

44
zshrc
View file

@ -8,6 +8,8 @@
# load bash/zsh/ksh agnostic configurations # load bash/zsh/ksh agnostic configurations
[ -e $HOME/.rc ] && source $HOME/.rc [ -e $HOME/.rc ] && source $HOME/.rc
print_info_noisy 1 "Initializing interactive Z Shell"
# PROMPT # PROMPT
# ' histnum bgjobsflag time (%|#)' # ' histnum bgjobsflag time (%|#)'
# Colors are determined based on zsh capability (>= version 4.3.7) # Colors are determined based on zsh capability (>= version 4.3.7)
@ -57,29 +59,29 @@ precmd_separator_info()
precmd_git_rprompt() precmd_git_rprompt()
{ {
gstat=`git status 2>/dev/null` #local gstat=`git status 2>/dev/null`
local branch=`git branch 2>/dev/null | grep '^\*' | cut -d' ' -f2`
if [[ $? != 0 ]]; then if [[ $? != 0 ]]; then
RPROMPT='' RPROMPT=''
return return
fi fi
branch=`echo $gstat | sed -n -e '2,$d' \
-e 's/.*\ \([^\ ^:\\*?\[]*\)$/\1/p'`
RPROMPT="%F{yellow}$branch%f" RPROMPT="%F{yellow}$branch%f"
echo $gstat | grep '^nothing' 1>/dev/null 2>&1 #echo $gstat | grep '^nothing' 1>/dev/null 2>&1
if [[ $? != 0 ]]; then #if [[ $? != 0 ]]; then
RPROMPT="%B%F{red}*%f%b$RPROMPT" # RPROMPT="%B%F{red}*%f%b$RPROMPT"
fi #fi
} }
precmd_functions=(precmd_xterm_title precmd_separator_info precmd_git_rprompt) precmd_functions=(precmd_xterm_title precmd_separator_info precmd_git_rprompt)
print_info_sub_noisy 2 'Initializing ZSH' print_info_sub_noisy 2 'Setting options'
# Shell options # Shell options
setopt \ setopt \
TRANSIENT_RPROMPT \ TRANSIENT_RPROMPT \
EXTENDED_GLOB \ EXTENDED_GLOB \
MULTIOS MULTIOS
print_info_sub_noisy 3 'Creating aliases'
alias pd='pushd' alias pd='pushd'
alias pod='popd' alias pod='popd'
@ -94,6 +96,7 @@ alias -s xml='vim'
alias -s jar='java -jar' alias -s jar='java -jar'
# History settings # History settings
print_info_sub_noisy 4 'Setting up history'
setopt \ setopt \
APPEND_HISTORY \ APPEND_HISTORY \
EXTENDED_HISTORY \ EXTENDED_HISTORY \
@ -108,15 +111,23 @@ HISTSIZE=1000000
SAVEHIST=1000000 SAVEHIST=1000000
HISTFILE="$HOME/.zhistory" HISTFILE="$HOME/.zhistory"
# emacs command line editing # command line editing mode
bindkey -v function {
local mode='vim'
print_info_sub_noisy 5 "Using $mode command line editing mode"
if [[ $mode == 'vim' ]]; then
bindkey -v
elif [[ $mode == 'emacs' ]]; then
bindkey -e
fi
}
### ###
# Completion # Completion
### ###
print_info_sub_noisy 2 'Initializing completion' print_info_sub_noisy 2 'Initializing completion system'
# load completion system # load completion system
autoload -U compinit autoload -U compinit
@ -176,5 +187,12 @@ function up {
fi fi
} }
[ -e $HOME/.zshrc.$SYS ] && source $HOME/.zshrc.$SYS if [ -e $HOME/.zshrc.$SYS ]; then
[ -e $HOME/.zshrc.local ] && source $HOME/.zshrc.local print_info_noisy 3 "Sourcing ${SYS}-specific Z Shell settings"
source $HOME/.zshrc.$SYS
fi
if [ -e $HOME/.zshrc.local ]; then
print_info_noisy 3 "Sourcing local Z Shell settings"
source $HOME/.zshrc.local
fi