-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bash_prompt
39 lines (30 loc) 路 898 Bytes
/
.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
#!bin/bash
HOST_NAME=Luca
# TODO https://unix.stackexchange.com/questions/2897/clicolor-and-ls-colors-in-bash
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
bldgrn='\e[1;32m' # Bold Green
bldpur='\e[1;35m' # Bold Purple
txtrst='\e[0m' # Text Reset
parse_git_branch() {
pr=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/')
if [ -z ${pr} ]; then
echo ""
return;
fi
echo " git:${pr}"
}
print_before_the_prompt () {
dir=$PWD
home=$HOME
dir=${dir/"$HOME"/"~"}
printf "\n $txtred%s: $bldpur%s $txtgrn%s\n$txtrst" "$HOST_NAME" "$dir" "$(vcprompt)"
}
# TODO git-dirty
emojis=("馃殌" "馃槇" "馃嵒" "馃嵑")
EMOJI=${emojis[$RANDOM % ${#emojis[@]} ]}
PROMPT_COMMAND=print_before_the_prompt
PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
PS1="$EMOJI => "