get git-prompt working by modifying PS1

This commit is contained in:
Mark Eaton
2025-08-13 13:20:47 -04:00
parent fb63fdf48e
commit 70b423ce0c
+16 -10
View File
@@ -1,5 +1,4 @@
alias log='git log --graph --decorate --all' alias log='git log --graph --decorate --all'
alias ll='ls -la'
alias up='sudo apt-get -y update && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove' alias up='sudo apt-get -y update && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove'
alias python="python3" alias python="python3"
alias vim="nvim" alias vim="nvim"
@@ -36,7 +35,7 @@ shopt -s checkwinsize
#shopt -s globstar #shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1) # make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below) # set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
@@ -65,7 +64,9 @@ if [ -n "$force_color_prompt" ]; then
fi fi
if [ "$color_prompt" = yes ]; then if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 " (%s)") \$ ' # modified to show git prompt
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]: \[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 " (%s)") \$ '
# PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' original git-prompt PS1 variable setting
else else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi fi
@@ -87,18 +88,22 @@ if [ -x /usr/bin/dircolors ]; then
#alias dir='dir --color=auto' #alias dir='dir --color=auto'
#alias vdir='vdir --color=auto' #alias vdir='vdir --color=auto'
#alias grep='grep --color=auto' alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto' alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto' alias egrep='egrep --color=auto'
fi fi
# colored GCC warnings and errors # colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# some more ls aliases # some more ls aliases
#alias ll='ls -l' alias ll='ls -alF'
#alias la='ls -A' alias la='ls -A'
#alias l='ls -CF' alias l='ls -CF'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Alias definitions. # Alias definitions.
# You may want to put all your additions into a separate file like # You may want to put all your additions into a separate file like
@@ -120,7 +125,8 @@ if ! shopt -oq posix; then
fi fi
fi fi
export NVM_DIR="$HOME/.config/nvm" export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
. "$HOME/.local/bin/env"