commit 68e55e499fb942e81df9cab2571ba4ea81a4b61d
parent a127725b91b18a3de94873594eaaffafffbea871
Author: Anders Hedman <anders.hedman01@gmail.com>
Date: Tue, 29 Sep 2026 20:10:08 +0200
chore(bashrc): guard PATH, autoload completions
Replace the single PATH guard with per-entry case guards so each
directory is prepended exactly once, including ~/.opencode/bin.
Source every script in ~/.bash_completions instead of hardcoding
each completion file.
Diffstat:
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/.bashrc b/.bashrc
@@ -18,12 +18,20 @@ if [ -f ~/.bash_aliases ]; then
fi
# User specific environment
-if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
-then
- PATH="$HOME/.local/bin:$HOME/bin:$PATH"
-fi
+case ":$PATH:" in *":$HOME/bin:"*) ;; *) PATH="$HOME/bin:$PATH" ;; esac
+case ":$PATH:" in *":$HOME/.local/bin:"*) ;; *) PATH="$HOME/.local/bin:$PATH" ;; esac
+case ":$PATH:" in *":$HOME/.opencode/bin:"*) ;; *) PATH="$HOME/.opencode/bin:$PATH" ;; esac
export PATH
+# Bash completions
+if [ -d ~/.bash_completions ]; then
+ for rc in ~/.bash_completions/*; do
+ if [ -f "$rc" ]; then
+ . "$rc"
+ fi
+ done
+fi
+
#Foreground colors, Normal (non-bold) is the default, so the 0; prefix is optional.
#
#\e[0;30m = Dark Gray
@@ -73,13 +81,8 @@ complete -C /usr/bin/vault vault
eval "$(direnv hook bash)"
# opencode
-export PATH=/home/anders/.opencode/bin:$PATH
export OLLAMA_CONTEXT_LENGTH=64000
-source '/home/anders/.bash_completions/opencode.sh'
# >>> oh-my-opencode-slim background subagents >>>
export OPENCODE_EXPERIMENTAL_BACKGROUND_SUBAGENTS=true
export OPENCODE_ENABLE_EXA=1
# <<< oh-my-opencode-slim background subagents <<<
-
-source '/home/anders/.bash_completions/unsloth.sh'
-source '/home/anders/.bash_completions/herdr.sh'