32 lines
1.2 KiB
Bash
32 lines
1.2 KiB
Bash
# vim:syntax=sh
|
|
if [[ "`whoami`" == "root" ]]; then
|
|
PS1='\[\033[31;1m\]\u@\H\[\033[32;1m\] [\w]\[\033[35;1m\] \d \t \[\033[33;1m\](\j)\n\$ \[\033[0m\]'
|
|
else
|
|
PS1='\[\033[35;1m\]\u@\H\[\033[31;1m\] [\w]\[\033[32;1m\] \d \t \[\033[33;1m\](\j)\[\033[33;1m\]$(prompt_ps1_git_branch)\[\033[33;1m\]\$ \[\033[0m\]'
|
|
fi
|
|
# alternate PS1:
|
|
# PS1='[\[\033[31;1m\]\u@\H\[\033[34;1m\] \w\[\033[0m\]]\$ \[\033[0m\]'
|
|
case "$TERM" in
|
|
[ax]term*|rxvt*)
|
|
PROMPT_COMMAND='cdshowgitstatus;echo -ne "\033]0;"$(basename ${PWD})" [${USER}@${HOSTNAME}: ${PWD}]\007"'
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|
|
alias grep='grep --color=auto'
|
|
alias grepnosvn='grep --color=auto --exclude-dir=".svn"'
|
|
alias egrepnosvn='egrep --color=auto --exclude-dir=".svn"'
|
|
alias gvim='gvim --remote-tab-silent'
|
|
alias cdshowgitstatus='if [[ $CDSHOWGITSTATUS_LAST_WD != $PWD ]]; then if [[ -d .git ]]; then git status; fi; CDSHOWGITSTATUS_LAST_WD=$PWD; fi'
|
|
#PROMPT_COMMAND="$PROMPT_COMMAND;cdshowgitstatus"
|
|
function prompt_ps1_git_branch()
|
|
{
|
|
if [[ -e /usr/bin/git && "$PCGB_LAST_WD" != "$PWD" ]]; then
|
|
current_git_branch=$(git branch 2>/dev/null | grep '^\*' | sed -e 's/^..//');
|
|
PCGB_LAST_WD=$PWD;
|
|
fi;
|
|
if [[ "$current_git_branch" != "" ]]; then
|
|
echo -e " [${current_git_branch}]";
|
|
fi
|
|
}
|