diff --git a/config/starship.toml b/config/starship.toml index 92d3850..6d6bc3d 100644 --- a/config/starship.toml +++ b/config/starship.toml @@ -4,7 +4,7 @@ format = """ $username\ $hostname\ -[┌──(](bold green)$username[@](bold green)$hostname[)─[](bold green)$directory[$git_branch$git_status](bold green)[]\n](bold green)\ +[┌──\\(](bold green)$username[@](bold green)$hostname[\\)─\\[](bold green)$directory[$git_branch$git_status](bold green)[\\]](bold green)\n\ $git_state\ $nodejs$python$rust$golang\ $cmd_duration\ diff --git a/dotfiles/.zshrc.d/atuin.zsh b/dotfiles/.zshrc.d/atuin.zsh index fa2fb5e..4903a0f 100644 --- a/dotfiles/.zshrc.d/atuin.zsh +++ b/dotfiles/.zshrc.d/atuin.zsh @@ -2,6 +2,10 @@ # ~/.zshrc.d/atuin.zsh — Atuin shell history # --disable-up-arrow keeps default ↑ behavior; use Ctrl-R for atuin search +# Add ~/.atuin/bin to PATH when installed via curl installer +# shellcheck source=/dev/null +[ -f "$HOME/.atuin/bin/env" ] && . "$HOME/.atuin/bin/env" + if command -v atuin >/dev/null 2>&1; then eval "$(atuin init zsh --disable-up-arrow)" fi diff --git a/modules/shell.sh b/modules/shell.sh index 6ad3628..d0bf588 100755 --- a/modules/shell.sh +++ b/modules/shell.sh @@ -67,13 +67,26 @@ _install_zoxide() { _install_atuin() { if has_cmd atuin; then info "atuin already installed" - return - fi - info "Installing atuin..." - if [ "$PKG_MGR" = "brew" ]; then - brew install atuin else - curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh + info "Installing atuin..." + if [ "$PKG_MGR" = "brew" ]; then + brew install atuin + else + # ATUIN_NO_MODIFY_SHELL=1 prevents atuin's installer from appending + # init code to ~/.zshrc — our .zshrc.d/atuin.zsh handles that instead. + ATUIN_NO_MODIFY_SHELL=1 curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | ATUIN_NO_MODIFY_SHELL=1 sh + fi + fi + + # Remove any lines atuin's installer may have already appended to ~/.zshrc. + # These duplicate the .zshrc.d/atuin.zsh setup and cause + # "(eval):1: can't change option: zle" on every shell start. + if grep -q '\.atuin/bin/env\|atuin init' "${HOME}/.zshrc" 2>/dev/null; then + info "Removing duplicate atuin init lines from ~/.zshrc..." + sed -i '/^\. ".*\.atuin\/bin\/env"/d' "${HOME}/.zshrc" + # shellcheck disable=SC2016 # $() in single quotes is intentional (literal match) + sed -i '/^eval "\$(atuin init/d' "${HOME}/.zshrc" + success "Cleaned up ~/.zshrc" fi }