diff options
Diffstat (limited to 'zsh')
-rw-r--r-- | zsh/appearance.zsh | 13 | ||||
-rw-r--r-- | zsh/behavior.zsh | 2 | ||||
-rw-r--r-- | zsh/functions.zsh-overrides | 2 | ||||
-rw-r--r-- | zsh/key-bindings.zsh | 2 |
4 files changed, 12 insertions, 7 deletions
diff --git a/zsh/appearance.zsh b/zsh/appearance.zsh index d5d4a65..ffe391c 100644 --- a/zsh/appearance.zsh +++ b/zsh/appearance.zsh @@ -1,15 +1,15 @@ -#done - autoload colors; colors; -setopt prompt_subst # expansion of color codes, etc. +setopt prompt_subst # enable expansion of color codes, etc. in the prompt # Find the option for using colors in ls, depending on the version: Linux or BSD ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty' || alias ls='ls -G' export LSCOLORS="exgxbxdxcxegedxbxgxcxd" +# enable colorful grep output export GREP_OPTIONS='--color=auto' export GREP_COLOR='1;32' +# enable colorful less output export LESS_TERMCAP_mb=$'\e[0;31m' # begin blinking - red export LESS_TERMCAP_md=$'\e[0;34m' # begin bold - blue export LESS_TERMCAP_me=$'\e[0m' # end mode @@ -18,10 +18,13 @@ export LESS_TERMCAP_se=$'\e[0m' # end standout mode export LESS_TERMCAP_us=$'\e[4;33m' # begin underline - yellow underline export LESS_TERMCAP_ue=$'\e[0m' # end underline +# print the fully resolved shell command with time stamp +# to be run from zsh's builtin 'preexec' with all arguments passed through ($*) function theme_preexec () { echo "($fg[magenta]`date +%r`$reset_color) $fg[cyan]$3$reset_color" } +# print the exit code in red if nonzero function return_code { code=$(echo $?) if [[ $code == "0" ]]; then @@ -31,22 +34,26 @@ function return_code { fi } +# print the svn revision number when in an svn repo (rREVISION) function svn_prompt_info { info=$(svn info 2>/dev/null) || return rev=$(echo "$info" | grep Revision | sed 's/Revision: //') echo "(r${rev}) " } +# print the git branch name when in a git repo (BRANCH) function git_prompt_info { ref=$(git symbolic-ref HEAD 2> /dev/null) || return echo "(${ref#refs/heads/}) " } +# print a special prompt character depending on the vcs of the current dir function prompt_char { git branch >/dev/null 2>/dev/null && echo '±' && return svn info >/dev/null 2>/dev/null && echo 'ϟ' && return echo '$' } +# a colorful multiline prompt using the above defined functions PROMPT='%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[green]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%} $(return_code)$(svn_prompt_info)$(git_prompt_info)$(prompt_char)%{$reset_color%} ' diff --git a/zsh/behavior.zsh b/zsh/behavior.zsh index 8920fad..b305c91 100644 --- a/zsh/behavior.zsh +++ b/zsh/behavior.zsh @@ -31,6 +31,8 @@ setopt hist_verify # load hist into command buffer rather than exec immediately # # term support +# set term title appropriately based on term type +# user@host:current_dir (current_command) case "$TERM" in xterm*|rxvt*) term_preexec () { diff --git a/zsh/functions.zsh-overrides b/zsh/functions.zsh-overrides index b2db877..9826007 100644 --- a/zsh/functions.zsh-overrides +++ b/zsh/functions.zsh-overrides @@ -1,5 +1,3 @@ -#done - preexec () { term_preexec $* theme_preexec $* diff --git a/zsh/key-bindings.zsh b/zsh/key-bindings.zsh index 263ec4f..4deac62 100644 --- a/zsh/key-bindings.zsh +++ b/zsh/key-bindings.zsh @@ -1,5 +1,3 @@ -#done - bindkey -e # use emacs mode bindkey '^r' history-incremental-search-backward # ctrl-r bindkey '^[[Z' reverse-menu-complete # shift-tab |