-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprompt
81 lines (74 loc) · 2.55 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
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
#!/sw/bin/zsh
if [ $NOISY ]; then
echo "reading ~/Library/init/zsh/prompt"
fi
################################################################
# prompt v0.0.1 for use with Bash on Darwin-OSX ......
# by Gary Kerbaugh
# Send comments, bugs or money to [email protected]
#
# Source this file from you .bashrc to set your prompt to a colored prompt including
# the PWD trimmed, tcsh-style, to the last 3 levels. Also the history number is colored
# by success of the last command.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
################################################################
#--------------------------------------------------------------------------------------------
# function issucceed: Sets the "HISTORY_COLOR" based on the success of the previous command
#--------------------------------------------------------------------------------------------
# function issucceed
# {
# if [ "$1" -eq 0 ]; then
# HIST_COLOR="$BOLD_RED"
# PREFIX=""
# else
# HIST_COLOR="$BOLD_BLACK"
# PREFIX="[$BOLD_RED${1}$BLACK]"
# fi
# }
#-------------------------------------------------------------------
# function precmd: Calls the other functions and creates the prompt
#-------------------------------------------------------------------
# function precmd
# {
# issucceed "$?"
# PS1="${PREFIX}[$BOLD_BLUE%n$BLACK@$BOLD_GREEN%m$BLACK]$BOLD_MAUVE%3c $HIST_COLOR%! $DEFAULT%# "
#
# #PS1="%3c # "
#
# export PS1
# }
#--------------------------------------------
# Color constants used in the prompt
#--------------------------------------------
BLACK="%{[0m%}"
BOLD_BLACK="%{[1;30m%}"
RED="%{[0;31m%}"
BOLD_RED="%{[1;31m%}"
GREEN="%{[0;32m%}"
BOLD_GREEN="%{[1;32m%}"
YELLOW="%{[0;33m%}"
BOLD_YELLOW="%{[1;33m%}"
BLUE="%{[0;34m%}"
BOLD_BLUE="%{[1;34m%}"
MAUVE="%{[0;35m%}"
BOLD_MAUVE="%{[1;35m%}"
CYAN="%{[0;36m%}"
BOLD_CYAN="%{[1;36m%}"
WHITE="%{[0;37m%}"
DEFAULT="%{[0;39m%}"
#PS1="[$BOLD_BLUE%n$BLACK@$BOLD_GREEN%m$BLACK]$BOLD_MAUVE%3c %! $BLACK%# "
#PS1="[$BLACK%m] $RED%1c $BLACK%# "
if [ ${+SSH_CLIENT} -eq 0 ]; then # not connecting by SSH
PS1="$RED%1c $BLACK%# "
else
PS1="[$BLACK%m] $RED%1c $BLACK%# "
fi