Skip to content
Newer
Older
100644 45 lines (35 sloc) 1.3 KB
2a3032a @falconindy overhaul bash config, split into a bunch of files
authored Jul 31, 2011
1 #!/bin/bash
2
3 bash_prompt() {
4 case $TERM in
5 @(xterm|rxvt)*)
6 local TITLEBAR='\[\e]0;\u:${NEW_PWD}\007\]' ;;
7 esac
8
a65b492 @falconindy prompt: it looks like a rewrite, but it isnt
authored Jan 8, 2012
9 local NONE='\[\e[0m\]' # unsets color to term's fg color
2a3032a @falconindy overhaul bash config, split into a bunch of files
authored Aug 1, 2011
10
11 # regular colors
a65b492 @falconindy prompt: it looks like a rewrite, but it isnt
authored Jan 9, 2012
12 local K='\[\e[0;30m\]' R='\[\e[0;31m\]' G='\[\e[0;32m\]' Y='\[\e[0;33m\]' \
13 B='\[\e[0;34m\]' M='\[\e[0;35m\]' C='\[\e[0;36m\]' W='\[\e[0;37m\]'
2a3032a @falconindy overhaul bash config, split into a bunch of files
authored Aug 1, 2011
14
15 # emphasized (bolded) colors
a65b492 @falconindy prompt: it looks like a rewrite, but it isnt
authored Jan 9, 2012
16 local EMK='\[\e[1;30m\]' EMR='\[\e[1;31m\]' EMG='\[\e[1;32m\]' EMY='\[\e[1;33m\]' \
17 EMB='\[\e[1;34m\]' EMM='\[\e[1;35m\]' EMC='\[\e[1;36m\]' EMW='\[\e[1;37m\]'
2a3032a @falconindy overhaul bash config, split into a bunch of files
authored Aug 1, 2011
18
19 # username/host color for root/other
20 (( UID != 0 )) && local UC=$W || local UC=$R
21
22 RET_VALUE='$((( RET )) && printf ":\[\e[1;31m\]$RET\[\e[0m\]")'
23
5bbd6df @falconindy prompt: use different color for remote host
authored Dec 11, 2011
24 # different color for remote hosts
a65b492 @falconindy prompt: it looks like a rewrite, but it isnt
authored Jan 9, 2012
25 [[ $SSH_TTY ]] && local HC=$C || local HC=$W
5bbd6df @falconindy prompt: use different color for remote host
authored Dec 12, 2011
26
2a3032a @falconindy overhaul bash config, split into a bunch of files
authored Aug 1, 2011
27 # space goes inside the printf so its not there when there's no git branch
b385bf2 @falconindy prompt: switch unicode prompt ending
authored Aug 4, 2012
28 PS1="$TITLEBAR $EMK┌┤$HC\h$EMK->$UC\u$RET_VALUE\$(__git_ps1 ' \[\e[0;32m\]%s\[\e[0m\]') $EMB\w$EMK$UC\n $EMK└➤$NONE "
2a3032a @falconindy overhaul bash config, split into a bunch of files
authored Aug 1, 2011
29 export PS4='+$BASH_SOURCE[$LINENO]: '
30 }
31
a65b492 @falconindy prompt: it looks like a rewrite, but it isnt
authored Jan 9, 2012
32 # chroot prompt
33 if [[ -f /.chroot ]]; then
34 root_name=$(< /.chroot)
35 root_name=${root_name:-NONAME}
36 PS1='[\u@\h${root_name} \w]\$ '
37 return
38 else
39 # show return val of last command
40 PROMPT_COMMAND='RET=$?'
41 GIT_PS1_SHOWDIRTYSTATE=yes
42 bash_prompt
43 unset bash_prompt
44 fi
Something went wrong with that request. Please try again.