diff --git a/rootfs/home/developer/.bash_aliases b/rootfs/home/developer/.bash_aliases index 7932036..0a6da46 100644 --- a/rootfs/home/developer/.bash_aliases +++ b/rootfs/home/developer/.bash_aliases @@ -16,12 +16,11 @@ export HISTCONTROL=ignoreboth:erasedups export HISTTIMEFORMAT='%F %T ' shopt -s histappend 2>/dev/null shopt -s cmdhist 2>/dev/null -# Flush every command to disk immediately so reboots don't lose recent work. -# Guarded so repeated sourcing (e.g. `exec bash`) doesn't stack duplicates. -if [ -z "${DEVBOX_HIST_SET:-}" ]; then - PROMPT_COMMAND="history -a; ${PROMPT_COMMAND:-}" - export DEVBOX_HIST_SET=1 -fi +# Note: PROMPT_COMMAND="history -a" is installed LATER in this file, +# after zoxide's init runs. Installing it here would create a +# "history -a;;__zoxide_hook" chain because zoxide's init uses ';' +# as its separator and prepends itself; two adjacent ';' breaks the +# parser. See https://github.com/ajeetdsouza/zoxide/issues/722. # ── Common aliases ─────────────────────────────────────────────────── # Prefer eza (modern ls) when available @@ -65,6 +64,16 @@ if command -v fzf >/dev/null 2>&1; then eval "$(fzf --bash)" 2>/dev/null || true fi +# ── PROMPT_COMMAND: flush history every prompt ─────────────────────── +# Installed AFTER zoxide init so zoxide's hook is already in place; +# we append with a newline separator to avoid the ';;' parse error +# described at the top of this file. Guarded so repeated sourcing +# (e.g. `exec bash`) doesn't stack duplicates. +if [ -z "${DEVBOX_HIST_SET:-}" ]; then + PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a" + export DEVBOX_HIST_SET=1 +fi + # ── Prompt: show [opencode-devbox] tag so it's obvious you're in the container # Preserves the default Debian PS1 logic but prefixes with a container marker. if [ -n "${PS1:-}" ] && [ -z "${DEVBOX_PS1_SET:-}" ]; then