aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjyn <github@jyn.dev>2025-06-05 08:26:37 -0400
committerGitHub <noreply@github.com>2025-06-05 13:26:37 +0100
commit2814c2031cde347c5b17af6b82dc53e27a40f9a9 (patch)
tree5a0127e7af4a29f20ddebeef040c9eba6b1c41af
parentfix(doctor): mention the required ble.sh version (#2774) (diff)
downloadatuin-2814c2031cde347c5b17af6b82dc53e27a40f9a9.zip
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.
-rw-r--r--crates/atuin/src/shell/atuin.zsh3
1 files changed, 2 insertions, 1 deletions
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