-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_prompt
88 lines (68 loc) · 2.6 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
# This makes it easyer to use colors in bash-output
# Cli Colors
export CLICOLOR=1
# use yellow for dir’s
export LSCOLORS=dxfxcxdxbxegedabagacad
# Shell prompt based on the Solarized Dark theme.
# Screenshot: http://i.imgur.com/EkEtphC.png
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM='gnome-256color';
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM='xterm-256color';
fi;
# Highlight the user name when logged in as root.
if [[ "${USER}" == "root" ]]; then
userStyle="${red}";
else
# userStyle="${cyan}";
userStyle="${white}";
fi;
if [[ "${SSH_TTY}" ]]; then
hostStyle="${bold}${red}";
else
hostStyle="$(tput setaf 244)";
fi;
PS1=''
GIT_PROMPT=$(getGitPrompt 0)
GIT_PROMPT_COLORED=$(getGitPrompt 1)
# \d means date; takes 9 + 1 spaces
# \t means time takes 8 + 1 spaces
#PS1='\[$(echo $(tput setaf 236); printf "%*s" $(( COLUMNS-1 )) " $(echo $GIT_PROMPT_COLORED)" | sed "s/ /-/g") \r'
PS1='\[$(echo $(tput setaf 236); printf "%*s" $(($(tput cols)-21)) "" | sed "s/ /-/g") \d ---- \A\r'
#PS1='\[$(echo $(tput setaf 236); printf "%*s" $(($(tput cols)-20-${#GIT_PROMPT})) "" | sed "s/ /-/g") \d \t\r'
# Set the terminal title to the current working directory.
#PS1+="\[\033]0;\w\007\]";
#PS1+="\[${bold}\]\n"; # newline
#PS1+="\n"; # newline
PS1+="\[${userStyle}\]\u${reset}"; # username
PS1+="\[$(tput setaf 236)\] @ ${reset}";
PS1+="\[${hostStyle}\]\h${reset}"; # host
# This is broken since Sierra
# if ifconfig | grep -q utun1; then
# PS1+="\[${white}\] ${reset}"; # OpenVPN connected
# elif ifconfig | grep -q ppp0; then
# PS1+="\[${green}\] 🏢 ${reset}"; # PPPoE connected
# fi
PS1+="\[$(tput setaf 236)\] in ";
# PS1+="\[${cyan}\]\W"; # working directory
PS1+="\[${cyan}\]\W"; # working directory
PS1+="\$(getGitPrompt 1)"; # Git repository details
# Highlight the hostname when connected via SSH.
if [[ "${SSH_TTY}" ]]; then
PS1+="\[$(tput setaf 236)\] through ";
PS1+="\[${green}\]SSH${reset}"; # host
fi;
PS1+=' \]'
#PS1='\[$(printf "%*s" $(($(tput cols)-20)) "" | sed "s/ /-/g") \d \t\r\u @ \h : \w \]'
#PS1='\[$(printf "%*s" $(($(tput cols)-20)) "" | sed "s/ /-/g") \d \t\r\u@\h:\w \]'
PS1+="\n";
PS1+="\[$(tput setaf 236)\]\$ \[${reset}\]"; # `$` (and reset color)
export PS1;
PS2="\[${yellow}\]→ \[${reset}\]";
export PS2;
# For managing multiple java versions on one machine. i need this for the switch from [email protected] to [email protected]
# Switch versions with
# jenv global 11.0
# java -version
# https://stackoverflow.com/questions/26252591/mac-os-x-and-multiple-java-versions
if which jenv > /dev/null; then eval "$(jenv init -)"; fi