From 7cf88c785ed0890b653a36e8e6770d5448dfb3c5 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Fri, 17 Aug 2012 12:48:04 -0700 Subject: [PATCH] Mostly message printing updates; some other random stuff too --- env | 8 ++++++-- rc | 7 ++++++- zshrc | 44 +++++++++++++++++++++++++++++++------------- 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/env b/env index a637661..f0b78f9 100644 --- a/env +++ b/env @@ -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 diff --git a/rc b/rc index 9e95e27..db9813d 100644 --- a/rc +++ b/rc @@ -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 diff --git a/zshrc b/zshrc index 439e92e..7312243 100644 --- a/zshrc +++ b/zshrc @@ -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