git.lirion.de

Of git, get, and gud

aboutsummaryrefslogtreecommitdiffstats
path: root/.bash
diff options
context:
space:
mode:
Diffstat (limited to '.bash')
-rw-r--r--.bash/postexec.bash7
-rw-r--r--.bash/prompt.bash14
-rw-r--r--.bash/vars.bash2
3 files changed, 21 insertions, 2 deletions
diff --git a/.bash/postexec.bash b/.bash/postexec.bash
index 564356a..6137814 100644
--- a/.bash/postexec.bash
+++ b/.bash/postexec.bash
@@ -6,3 +6,10 @@ if [ -n "$SSHENVFILE" ] && [ -r "$SSHENVFILE" ];then
fi
fi
fi
+for gitpsrc in "/usr/share/git/git-prompt.sh" "/usr/local/share/git/git-prompt.sh" \
+ "/usr/share/git-completion/prompt.sh" "/usr/local/share/git-completion/prompt.sh"; do
+ if [ -r "$gitpsrc" ]; then
+ source "$gitpsrc"
+ break
+ fi
+done
diff --git a/.bash/prompt.bash b/.bash/prompt.bash
index 6914d63..8c4dbaa 100644
--- a/.bash/prompt.bash
+++ b/.bash/prompt.bash
@@ -145,7 +145,19 @@ __prompt_command() {
PS1="\\# \[$(tput bold)\]\[$($FGC1)\]\t \[$($FGC2)\]\\u$UHSEP\[$($FGC3)\]$PHN \\w \[$(tput sgr0)\]\\n"
;;
esac
- if command -v __git_ps1 >/dev/null 2>&1;then PS1+="$(__git_ps1 "%s ")";fi
+ # git-completion. Sources:
+ # - https://github.com/git/git/tree/master/contrib/completion (main)
+ # - https://github.com/felipec/git-completion (fork)
+ # - Debian: easygit (outdated! you may want to use something like /git-prompt inside this repo)
+ # - Arch: git-completion (AUR, with functionality tests) - search for ...share/git(-completion)?/prompt.sh
+ # - Manual measure: this repository, /git-prompt
+ # Why all this fuss? magicmonty takes control over the whole prompt, __git_ps1 only serves a part
+ # of it. We don't like monoliths, we like modules; the latter is good practice.
+ # also, see postexec --> one-time sourcing of git's prompt.sh
+ if command -v __git_ps1 >/dev/null 2>&1;then
+ GIT_PS1_SHOWCOLORHINTS=1
+ PS1+="$(__git_ps1 "%s ")"
+ fi
if [ "$EXIT" -eq 0 ];then
PS1+="\[\033[0;32m\]# "
elif [ "$EXIT" -eq 255 ]||[ "$EXIT" -eq 127 ];then
diff --git a/.bash/vars.bash b/.bash/vars.bash
index da222b1..a7bdcb5 100644
--- a/.bash/vars.bash
+++ b/.bash/vars.bash
@@ -18,7 +18,7 @@ SSHAGH+=( "woschd.example.com" )
export SSHAGH
# ----- SHELL ----- #
-for pa in "/usr/local/bin" "${HOME}/bin" "${HOME}/.local/bin";do
+for pa in "/usr/local/bin" "${HOME}/bin" "${HOME}/.local/bin" "${HOME}/go/bin";do
if [ -x "$pa" ]; then
if ! printf "%b" "$PATH"|grep -P "^${pa}:|:${pa}:" >/dev/null;then
export PATH="${pa}:${PATH}"