-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPs1.txt
executable file
·81 lines (67 loc) · 2.36 KB
/
Ps1.txt
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
PS1='\[\e[0m\]\[\e[48;5;236m\]\[\e[38;5;197m\]\u\[\e[38;5;197m\]@\[\e[38;5;197m\]\h\[\e[38;5;105m\]
\[\e[38;5;221m\]\w\[\e[38;5;221m\]\[\e[38;5;105m\]\[\e[0m\]\[\e[38;5;236m\]\342\226\214\342\226\214\342\226\214\[\e[0m\]'
==============================================
PS1="[\[\033[32m\]\w]\[\033[0m\]\$(__git_ps1)\n\[\033[1;36m\]\u\[\033[32m\]$ \[\033[0m\]"
==============================================
# man easier
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
export GREP_OPTIONS='--color=auto'
# soma asliases
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ll="ls -l"
alias lo="ls -o"
alias lh="ls -lh"
alias la="ls -la"
alias sl="ls"
alias l="ls"
alias s="ls"
#ANSI COLORS CODE
COLOR_RED="\033[0;31m"
COLOR_YELLOW="\033[0;33m"
COLOR_GREEN="\033[0;32m"
COLOR_OCHRE="\033[38;5;95m"
COLOR_BLUE="\033[0;34m"
COLOR_CYAN="\033[0;36m"
COLOR_LIGHT_GREEN="\033[1;32m"
COLOR_LIGHT_CYAN="\033[1;36m"
COLOR_WHITE="\033[0;37m"
COLOR_PINK="\033[01;35m"
COLOR_RESET="\033[0m"
function git_color {
local git_status="$(git status 2> /dev/null)"
if [[ ! $git_status =~ "working directory clean" ]]; then
echo -e $COLOR_RED
elif [[ $git_status =~ "Your branch is ahead of" ]]; then
echo -e $COLOR_PINK "SYNC DONE!..."
elif [[ $git_status =~ "nothing to commit" ]]; then
echo -e $COLOR_LIGHT_GREEN
else
echo -e $COLOR_OCHRE "Ready to pull"
fi
}
function git_branch {
local git_status="$(git status 2> /dev/null)"
local on_branch="On branch ([^${IFS}]*)"
local on_commit="HEAD detached at ([^${IFS}]*)"
if [[ $git_status =~ $on_branch ]]; then
local branch=${BASH_REMATCH[1]}\[$]
echo "($branch)"
elif [[ $git_status =~ $on_commit ]]; then
local commit=${BASH_REMATCH[1]}
echo "($commit)"
fi
}
PS1="\[$COLOR_YELLOW\]\n Route: [\w]\[$COLOR_LIGHT_CYAN\]\n [\@ - \d] \[$COLOR_LIGHT_GREEN\]\u\[$COLOR_OCHRE\] ssh:\h on " #base name PWD
PS1+="\[\$(git_color)\]" # colors git status
PS1+="\$(git_branch)" # prints current branch
PS1+="\[$COLOR_BLUE\]\$\[$COLOR_RESET\] " # '#' for root, else '$'
export PS1