Skip to content

Commit 2814c20

Browse files
authored
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.
1 parent 239e6fb commit 2814c20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

crates/atuin/src/shell/atuin.zsh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ zmodload zsh/datetime 2>/dev/null
1515
# you'd like to override this, then add your config after the $(atuin init zsh)
1616
# in your .zshrc
1717
_zsh_autosuggest_strategy_atuin() {
18-
suggestion=$(ATUIN_QUERY="$1" atuin search --cmd-only --limit 1 --search-mode prefix)
18+
# silence errors, since we don't want to spam the terminal prompt while typing.
19+
suggestion=$(ATUIN_QUERY="$1" atuin search --cmd-only --limit 1 --search-mode prefix 2>/dev/null)
1920
}
2021

2122
if [ -n "${ZSH_AUTOSUGGEST_STRATEGY:-}" ]; then

0 commit comments

Comments
 (0)