-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash-prompt
109 lines (98 loc) · 4 KB
/
.bash-prompt
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# -*- shell-script -*-
[[ ! -z $DEBUG ]] && echo "sourcing .bash-prompt"
# prompt due to Ayatoli (ayozone.org) (modified by Troy Pracy)
### FIXME ###
## remove cruft
#############
function pre_prompt {
newPWD="${PWD}"
user="whoami"
host=$(echo -n $HOSTNAME | sed -e "s/[\.].*//")
datenow=$(date "+%a, %d %b %y")
if [[ $TERM == "cygwin" ]]; then
taskbarsize=3
else
taskbarsize=
fi
### FIXME ###
## rewrite promptsize to give correct lengths of history no, no. jobs, shell name
## at the moment they're just set manually
#############
let promptsize=$(echo -n "┌(HH:MM, ddd DD mmm YY)(${PWD})-┐" | wc -c | tr -d " ")
let fillsize=$((COLUMNS-promptsize-taskbarsize))
fill=$(printf "%0.s─" $(seq $fillsize))
asciifill=$(printf "%0.s-" $(seq $fillsize))
if [ "$fillsize" -lt "0" ]; then
let cutt=3-${fillsize}
newPWD="...$(echo -n $PWD | sed -e "s/\(^.\{$cutt\}\)\(.*\)/\2/")"
fi
}
PROMPT_COMMAND=pre_prompt
# extra colours
#---------------
# export black="\[\033[0;38;5;0m\]"
# export red="\[\033[0;38;5;1m\]"
export orange="\[\033[0;38;5;130m\]"
# export green="\[\033[0;38;5;2m\]"
# export yellow="\[\033[0;38;5;3m\]"
# export blue="\[\033[0;38;5;4m\]"
export mblue="\[\033[0;38;5;12m\]"
export magenta="\[\033[0;38;5;55m\]"
export cyan="\[\033[0;38;5;6m\]"
# export white="\[\033[0;38;5;7m\]"
export coldblue="\[\033[0;38;5;33m\]"
export smoothblue="\[\033[0;38;5;111m\]"
export iceblue="\[\033[0;38;5;45m\]"
export turqoise="\[\033[0;38;5;50m\]"
export smoothgreen="\[\033[0;38;5;42m\]"
# ANSI colours: work on ConEmu
#------------------------------
export black="\[\033[0;0;30;40m\]"
export grey="\[\033[0;1;30;40m\]"
export red="\[\033[0;0;31;40m\]"
export bred="\[\033[0;1;31;40m\]"
export green="\[\033[0;0;32;40m\]"
export bgreen="\[\033[0;1;32;40m\]"
export yellow="\[\033[0;0;33;40m\]"
export byellow="\[\033[0;1;33;40m\]"
export blue="\[\033[0;0;34;40m\]"
export bblue="\[\033[0;1;34;40m\]"
export pink="\[\033[0;0;35;40m\]"
export bpink="\[\033[0;1;35;40m\]"
export aqua="\[\033[0;0;36;40m\]"
export baqua="\[\033[0;1;36;40m\]"
export white="\[\033[0;0;37;40m\]"
export bwhite="\[\033[0;1;37;40m\]"
export unset="\[\033[0m\]"
case "$TERM" in
cygwin)
col1=$bgreen
col2=$baqua
PS1="$col2┌─($col1$col2\!|$col1 \s--\j jobs--\$(date \"+%a, %d %b %y\")$col2)─\${fill}─($col1\$newPWD$col2)─┐\n$col2└─($col1\$(date \"+%H:%M\")$col2)─>$white "
;;
xterm|terminator|xterm-256color)
PS1="$mblue┌─($orange\$(date '+%H:%M, %a %d %b %y')$mblue)─\${fill}─($orange$PWD$mblue)─┐\n$mblue└─($baqua\#$mblue)─>$unset "
;;
rxvt-cygwin-native)
PS1=">> "
;;
screen)
PS1="$mblue┌─($orange\u@\h \$(date \"+%a, %d %b %y\")$mblue)─\${fill}─($orange\$newPWD\
$mblue)─┐\n$mblue└─($orange\$(date \"+%H:%M\") \$$mblue)─>$white "
;;
eterm-color|Eterm)
# emacs/ansi-term emacs/multi-term
PS1=">> "
;;
linux)
PS1="|-(\u@\h \$(date \"+%a, %d %b %y\"))-\${asciifill}-(\$newPWD\
)-|\n|-(\$(date \"+%H:%M\") \$)-> "
;;
*)
PS1="$mblue┌─($orange\$(date '+%H:%M, %a %d %b %y')$mblue)─\${fill}─($orange$PWD$mblue)─┐\n$mblue├─($baqua\#$mblue)─>$unset "
;;
esac
# GNU octave: the following command gives a similar prompt
# PS1("\\[\\033[01;32m\\]┌─(\\[\\033[01;36m\\]\\t\\[\\033[01;32m\\])───────────────────────────octave───────────────────────────────┐\n└─( \\[\\033[01;36m\\]\\#\\[\\033[01;32m\\] )─> \\[\\033[0m\\]")
# short version...
# PS1("\\[\\033[01;32m\\]┌─(\\[\\033[01;36m\\]\\t\\[\\033[01;32m\\])──octave─┐\n└─( \\[\\033[01;36m\\]\\#\\[\\033[01;32m\\] )─> \\[\\033[0m\\]")