-
Notifications
You must be signed in to change notification settings - Fork 0
/
prompt
55 lines (48 loc) · 1.84 KB
/
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
[ -z "$PS1" ] && return
function set_prompt {
[ "$TERM" == "dumb" ] && return
# define some useful colors (be sure to surround with '\[' and '\]' or it borks the term)
#######################################################################################
# color chart:
# Black 0;30 Dark Gray 1;30 Blue 0;34 Light Blue 1;34
# Red 0;31 Light Red 1;31 Purple 0;35 Light Purple 1;35
# Green 0;32 Light Green 1;32 Cyan 0;36 Light Cyan 1;36
# Brown 0;33 Yellow 1;33 Light Gray 0;37 White 1;37
# No color 0
white='\[\e[1;37m\]'
green='\[\e[0;32m\]'
GREEN='\[\e[1;32m\]'
cyan='\[\e[0;36m\]'
CYAN='\[\e[1;36m\]'
gray='\[\e[0;37m\]'
red='\[\e[0;31m\]'
RED='\[\e[1;31m\]'
black='\[\e[0;30m\]'
BLACK='\[\e[1;30m\]'
blue='\[\e[0;34m\]'
BLUE='\[\e[1;34m\]'
purple='\[\e[0;35m\]'
PURPLE='\[\e[1;35m\]'
yellow='\[\e[0;33m\]'
YELLOW='\[\e[1;33m\]'
nc='\[\e[0m\]'
BOLD='\[\e[1m\]'
backred='\[\e[41m\]'
USER_COLOR="$green"
[ "`id -u`" -eq 0 ] && USER_COLOR="$red"
GIT=""
[ `type -t __git_ps1` ] && GIT="$yellow\$(__git_ps1 ' (%s)')"
#export PS1="$RED\D{%H:%M:%S %m/%d} $yellow<\j> $yellow[$CYAN\w$yellow]$GIT\n$USER_COLOR\u$white@$blue\h $USER_COLOR\$ $nc"
export PS1="$yellow<\j> $USER_COLOR\u$white@$blue\h$CYAN:\w$GIT $USER_COLOR\\$ $nc"
tput setaf 1; tput bold
printf "%*s\r" "$COLUMNS" "$(date +'%H:%M:%S %m/%d')"
}
#Escape for screen
case $TERM in
xterm*|rxvt*)
export PROMPT_COMMAND='set_prompt; history -a; echo -ne "\033]0; ${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
;;
screen*)
export PROMPT_COMMAND='set_prompt; history -a; echo -ne "\033k ${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
;;
esac