-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinit.sh
31 lines (26 loc) · 1.01 KB
/
init.sh
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
export DOTBASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# -X doesn't clear screen on quit, -r keeps ascii codes
export LESS=-Xr
# git prompt stuff
GIT_PS1_SHOWUPSTREAM="git"
GIT_PS1_SHOWDIRTYSTATE=true
GIT_PS1_SHOWSTASHSTATE=true
GIT_PS1_SHOWCOLORHINTS=true
. $DOTBASE/git-prompt.sh
. $DOTBASE/git-completion.bash
PROMPT_COMMAND='es=$?'
UC="\[\033[0;36m\]" # user's color
[ $UID -eq "0" ] && UC="\[\033[0;31m\]" # root's color
PS1="\$( if [[ \$es == 0 ]]; then echo \"\[\033[01;32m\]\342\234\223\"; else echo \"\[\033[01;31m\]\342\234\227\$es\"; fi ) $(echo $UC)\u@\$PROMPTHOST:\[\033[01;35m\]\W\[\e[0;33;49m\]\$(__git_ps1)\[\e[0;0m\]\\$ "
gitvars() {
export author="$(git log --format='%an <%ae>' HEAD -n1)"
export hash="$(git log --format='%H' HEAD -n1)"
echo "\$author=\"$author\""
echo "\$hash=\"$hash\""
}
su() {
user=$( [[ -n $1 ]] && echo "-u $1" )
profile=$HOME/.bash_profile
sudo $user bash --rcfile $profile -i
}
function c { pygmentize -O style=monokai -f console256 -g $1 | less -RN; }