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
export NOISY=0
print_info_noisy 1 "Initializing environment for $SYS system"
print_info_noisy 1 'Initializing environment'
PAGER="less"
MANPAGER=$PAGER
EDITOR="vim"
@ -38,6 +38,7 @@ PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
export PATH
print_info_sub_noisy 2 "Setting up $SYS environment"
case $SYS in
darwin)
export PATH=$HOME/Library/Python/2.7/bin:$PATH
@ -56,4 +57,7 @@ case $SYS in
esac
# 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)'"
print_info_sub_noisy 2 "Sourcing ${SYS}-specific settings"
case $SYS in
darwin)
if binary_exists gls; then
@ -57,6 +58,7 @@ case $SYS in
esac
# Set up dircolors
print_info_sub_noisy 3 "Setting up dircolors"
if [ -e $HOME/.dircolors/$SYS.cfg ]; then
dircolors=$HOME/.dircolors/$SYS.cfg
else
@ -72,4 +74,7 @@ export NETHACKOPTIONS="color"
[ -e "$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
[ -e $HOME/.rc ] && source $HOME/.rc
print_info_noisy 1 "Initializing interactive Z Shell"
# PROMPT
# ' histnum bgjobsflag time (%|#)'
# Colors are determined based on zsh capability (>= version 4.3.7)
@ -57,29 +59,29 @@ precmd_separator_info()
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
RPROMPT=''
return
fi
branch=`echo $gstat | sed -n -e '2,$d' \
-e 's/.*\ \([^\ ^:\\*?\[]*\)$/\1/p'`
RPROMPT="%F{yellow}$branch%f"
echo $gstat | grep '^nothing' 1>/dev/null 2>&1
if [[ $? != 0 ]]; then
RPROMPT="%B%F{red}*%f%b$RPROMPT"
fi
#echo $gstat | grep '^nothing' 1>/dev/null 2>&1
#if [[ $? != 0 ]]; then
# RPROMPT="%B%F{red}*%f%b$RPROMPT"
#fi
}
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
setopt \
TRANSIENT_RPROMPT \
EXTENDED_GLOB \
MULTIOS
print_info_sub_noisy 3 'Creating aliases'
alias pd='pushd'
alias pod='popd'
@ -94,6 +96,7 @@ alias -s xml='vim'
alias -s jar='java -jar'
# History settings
print_info_sub_noisy 4 'Setting up history'
setopt \
APPEND_HISTORY \
EXTENDED_HISTORY \
@ -108,15 +111,23 @@ HISTSIZE=1000000
SAVEHIST=1000000
HISTFILE="$HOME/.zhistory"
# emacs command line editing
bindkey -v
# command line editing mode
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
###
print_info_sub_noisy 2 'Initializing completion'
print_info_sub_noisy 2 'Initializing completion system'
# load completion system
autoload -U compinit
@ -176,5 +187,12 @@ function up {
fi
}
[ -e $HOME/.zshrc.$SYS ] && source $HOME/.zshrc.$SYS
[ -e $HOME/.zshrc.local ] && source $HOME/.zshrc.local
if [ -e $HOME/.zshrc.$SYS ]; then
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