From 2814c2031cde347c5b17af6b82dc53e27a40f9a9 Mon Sep 17 00:00:00 2001 From: jyn Date: Thu, 5 Jun 2025 08:26:37 -0400 Subject: [PATCH] fix: Don't print errors in `zsh_autosuggest` helper (#2780) Previously, this would result in long multi-line errors when typing, making it hard to see the shell prompt: ``` $ Error: could not load client settings Caused by: 0: could not create config file 1: failed to create file `/home/jyn/.config/atuin/config.toml` 2: Required key not available (os error 126) Location: atuin-client/src/settings.rs:675:54 fError: could not load client settings Caused by: 0: could not create config file 1: failed to create file `/home/jyn/.config/atuin/config.toml` 2: Required key not available (os error 126) Location: atuin-client/src/settings.rs:675:54 faError: could not load client settings ``` Silence these in autosuggestions, such that they only show up when explicitly invoking atuin. --- crates/atuin/src/shell/atuin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/atuin/src/shell/atuin.zsh b/crates/atuin/src/shell/atuin.zsh index 93671a92..f26c3fab 100644 --- a/crates/atuin/src/shell/atuin.zsh +++ b/crates/atuin/src/shell/atuin.zsh @@ -15,7 +15,8 @@ zmodload zsh/datetime 2>/dev/null # you'd like to override this, then add your config after the $(atuin init zsh) # in your .zshrc _zsh_autosuggest_strategy_atuin() { - suggestion=$(ATUIN_QUERY="$1" atuin search --cmd-only --limit 1 --search-mode prefix) + # silence errors, since we don't want to spam the terminal prompt while typing. + suggestion=$(ATUIN_QUERY="$1" atuin search --cmd-only --limit 1 --search-mode prefix 2>/dev/null) } if [ -n "${ZSH_AUTOSUGGEST_STRATEGY:-}" ]; then