-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrkj-conda.zsh-theme
44 lines (35 loc) · 1.71 KB
/
rkj-conda.zsh-theme
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
# user, host, full path, and time/date
# on two lines for easier vgrepping
# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
function hg_prompt_info {
hg prompt --angle-brackets "\
<hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\
</%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
%{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}<
patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
}
PY3="%{$fg[green]%}"
PY2="%{$fg[yellow]%}"
RESET="%{$reset_color%}"
BRACKET="%{$fg_bold[blue]%}"
function myconda {
# PYV=`python -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)";`
PYPATH=$(which python)
NEW_PATH=${PYPATH: : -7}
PYV=$(ls $NEW_PATH | grep "^python[23].[0-9]$" | head -c 7 | tail -c 1)
env=$CONDA_DEFAULT_ENV
if [[ $env = "" ]]; then
env="root"
fi
if [[ ${PYV:0:1} = "3" ]]; then
prompt=$PY3$env$BRACKET
elif [[ ${PYV:0:1} = "2" ]]; then
prompt=$PY2$env$BRACKET
fi
echo "env: $prompt"
}
function retcode() {}
# alternate prompt with git & hg
PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[magenta]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[white]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}]
%{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(myconda)$(hg_prompt_info)>%{$reset_color%} '
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '