From: Jannik ZANDER Date: Sat, 30 Jun 2018 09:48:07 +0000 (+0200) Subject: Harmonice git-prompt X-Git-Url: https://git.zndr.dk/?a=commitdiff_plain;h=dfbd40a57fb536f013ed5a9248ffa2296cc53c40;p=dotfiles.git Harmonice git-prompt --- diff --git a/.bashrc b/.bashrc index 18706ad..2fcd7b4 100644 --- a/.bashrc +++ b/.bashrc @@ -4,8 +4,35 @@ [[ -z "$PS1" ]] && return # Set prompt -#PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 "(%s)")\$ ' -PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[31m\]$(__git_ps1 "(%s)")\[\033[01;34m\]\[\033[00m\]\$ ' +if test -z "$TITLEPREFIX"; then + PS1='\[\033]0;$TITLEPREFIX:$PWD\007\]' # git for windows +else + PS1='${debian_chroot:+($debian_chroot)}' # debian +fi + +PS1="$PS1"'\[\033[01;32m\]' # change color +PS1="$PS1"'\u@\h' # user@host +PS1="$PS1"'\[\033[00m\]' # change color +PS1="$PS1"':' # : +PS1="$PS1"'\[\033[01;34m\]' # change color +PS1="$PS1"'\w' # current working directory + +GIT_EXEC_PATH="$(git --exec-path 2>/dev/null)" +COMPLETION_PATH="${GIT_EXEC_PATH%/libexec/git-core}" +COMPLETION_PATH="${COMPLETION_PATH%/lib/git-core}" +COMPLETION_PATH="$COMPLETION_PATH/share/git/completion" +if test -f "$COMPLETION_PATH/git-prompt.sh" +then + . "$COMPLETION_PATH/git-completion.bash" + . "$COMPLETION_PATH/git-prompt.sh" + PS1="$PS1"'\[\033[31m\]' # change color + PS1="$PS1"'`__git_ps1`' # bash function +fi +PS1="$PS1"'\[\033[0m\]' # change color +PS1="$PS1"'\$ ' # prompt + +# PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1 "(%s)")\$ ' +# PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[31m\]$(__git_ps1 "(%s)")\[\033[01;34m\]\[\033[00m\]\$ ' export GIT_PS1_SHOWDIRTYSTATE=1 export GIT_PS1_SHOWCOLORHINTS=1