-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig
45 lines (38 loc) · 1.08 KB
/
config
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
# vi: ft=sh
function __clist(){
for line in {0..7}; do for col in {0..31}; do code=$(( $col * 8 + $line )); printf $'\e[38;05;%dm %03d' $code $code ;done; echo ;done
}
function __c(){
printf $'\[\e[38;05;%dm\]' $1
}
function __bclist(){
for line in {0..7}; do for col in {0..31}; do code=$(( $col * 8 + $line )); printf $'\e[48;05;%dm %03d' $code $code ;done; echo ;done
}
function __bc(){
printf $'\[\e[48;05;%dm\]' $1
}
if [ -z "$HOSTNAME" ]
then
HOSTNAME=$HOST
fi
vcprompt ()
{
local b="$(git symbolic-ref HEAD 2>/dev/null)";
if [ -n "$b" ]; then
local branch=${b##refs/heads/};
# Still not fast enough
#if [ "$(git status -suno)" ]; then
# local m="*"
#fi
if [ "$branch" = "master" ]; then
printf "%s " "m$m";
elif [ "$branch" = "trunk" ]; then
printf "%s " "t$m";
else
printf "%s " "b$m";
fi
fi
}
# Update the command prompt to be <user>:<current_directory>(git_branch) >
# Note that the git branch is given a special color
PS1="$HOSTNAME \$(vcprompt)\W "