mirror of
https://github.com/lloeki/dotfiles.git
synced 2025-12-06 07:24:39 +01:00
bash prompt with git info, using git_prompt_info
This commit is contained in:
parent
14df797f62
commit
32f8dbb9ef
1 changed files with 15 additions and 16 deletions
31
bash/prompt
31
bash/prompt
|
|
@ -41,24 +41,23 @@ __tpwd() {
|
||||||
__truncate_path "$PWD"
|
__truncate_path "$PWD"
|
||||||
}
|
}
|
||||||
|
|
||||||
#__print_rprompt() {
|
# git prompt info
|
||||||
# source "$DOTFILES_BASH_DIR/ansi_colors"
|
source $DOTFILES_BASH_DIR/git_prompt_info
|
||||||
# local rprompt=""
|
GIT_PS1_SHOWDIRTYSTATE=1
|
||||||
# local prompt=""
|
GIT_PS1_SHOWSTASHSTATE=1
|
||||||
# printf "%s%$(($COLUMNS-${#prompt}))s\r" $prompt $rprompt
|
GIT_PS1_SHOWUNTRACKEDFILES=1
|
||||||
#}
|
#GIT_PS1_DESCRIBE_STYLE=""
|
||||||
#PROMPT_COMMAND="$PROMPT_COMMAND __print_rprompt"
|
|
||||||
|
|
||||||
__set_bash_ps1() {
|
# dynamic prompt
|
||||||
|
__set_prompt() {
|
||||||
# load color vars
|
|
||||||
source "$DOTFILES_BASH_DIR/ansi_colors"
|
source "$DOTFILES_BASH_DIR/ansi_colors"
|
||||||
|
__git_ps1_vars
|
||||||
# colorized:
|
if [[ -n "${GIT_PS1_STATUS-}" ]]; then
|
||||||
PS1=" ${B}[${UC}\u@\h ${G}\$(__tpwd)${B}]${UC}\\$ ${NONE}"
|
PS1="${B}[${UC}\u@\h ${Y}${GIT_PS1_NAME}${UC}›${B}${GIT_PS1_BRANCH}${UC}›${G}${GIT_PS1_PREFIX}${B}]${UC}\\$ ${NONE}"
|
||||||
|
else
|
||||||
|
PS1="${B}[${UC}\u@\h ${G}$(__tpwd)${B}]${UC}\\$ ${NONE}"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
PROMPT_COMMAND="${PROMPT_COMMAND} __set_prompt;"
|
||||||
__set_bash_ps1
|
|
||||||
unset __set_bash_ps1
|
|
||||||
|
|
||||||
# vim: ft=sh
|
# vim: ft=sh
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue