blob: d5d4a65c118704bb802685bbee6e9e1d5606f741 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#done
autoload colors; colors;
setopt prompt_subst # expansion of color codes, etc.
# 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"
export GREP_OPTIONS='--color=auto'
export GREP_COLOR='1;32'
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
export LESS_TERMCAP_so=$'\e[30;46m' # begin standout mode - black on cyan
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
function theme_preexec () {
echo "($fg[magenta]`date +%r`$reset_color) $fg[cyan]$3$reset_color"
}
function return_code {
code=$(echo $?)
if [[ $code == "0" ]]; then
return
else
echo "%{$fg[red]%}$code%{$reset_color%} "
fi
}
function svn_prompt_info {
info=$(svn info 2>/dev/null) || return
rev=$(echo "$info" | grep Revision | sed 's/Revision: //')
echo "(r${rev}) "
}
function git_prompt_info {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo "(${ref#refs/heads/}) "
}
function prompt_char {
git branch >/dev/null 2>/dev/null && echo '±' && return
svn info >/dev/null 2>/dev/null && echo 'ϟ' && return
echo '$'
}
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%} '
|