blob: 33396d945c2769adb4b1bcab3b07da194a701b92 [file] [log] [blame]
Jesus de Mula Canoa38012f2011-03-04 11:44:56 +01001# ------------------------------------------------------------------ COLOR CONF
2D_DEFAULT_COLOR='${gray}'
3D_USER_COLOR='${purple}'
4D_SUPERUSER_COLOR='${red}'
5D_MACHINE_COLOR='${cyan}'
6D_DIR_COLOR='${green}'
7D_SCM_COLOR='${yellow}'
8D_BRANCH_COLOR='${yellow}'
9D_CHANGES_COLOR='${white}'
10D_CMDFAIL_COLOR='${red}'
11
12case $TERM in
13 xterm*)
14 TITLEBAR="\[\033]0;\w\007\]"
15 ;;
16 *)
17 TITLEBAR=""
18 ;;
19esac
20
21PS3=">> "
22
23is_vim_shell() {
24 if [ ! -z "$VIMRUNTIME" ]
25 then
26 echo "on ${cyan}vim shell${white} "
27 fi
28}
29
30mitsuhikos_lastcommandfailed() {
31 code=$?
32 if [ $code != 0 ]; then
33 echo -n '\[${white}\]exited \[${red}\]'
34 echo -n $code
35 echo -n '\[${white}\] '
36 fi
37}
38
39D_VCPROMPT_EXECUTABLE=~/.vcprompt/bin/vcprompt
40D_VCPROMPT_FORMAT="on ${D_SCM_COLOR}%s${white}:${D_BRANCH_COLOR}%b %r ${D_CHANGES_COLOR}%m%u ${white}"
41demula_vcprompt() {
42 $D_VCPROMPT_EXECUTABLE -f "$D_VCPROMPT_FORMAT"
43}
44
45prompt() {
46 # Yes, the indenting on these is weird, but it has to be like
47 # this otherwise it won't display properly.
48
49 PS1="\n${TITLEBAR}\[${D_USER_COLOR}\]\u ${white}\
50at \[${D_MACHINE_COLOR}\]\h ${white}\
51in \[${D_DIR_COLOR}\]\w ${white}\
52$(mitsuhikos_lastcommandfailed)\
53$(demula_vcprompt)\
54$(is_vim_shell)
55$ ${normal}"
56}
57
58PS2="$ "
59
60PROMPT_COMMAND=prompt