mirror of
https://github.com/atuinsh/atuin.git
synced 2025-08-18 02:50:38 +02:00
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.
This commit is contained in:
@@ -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)
|
# you'd like to override this, then add your config after the $(atuin init zsh)
|
||||||
# in your .zshrc
|
# in your .zshrc
|
||||||
_zsh_autosuggest_strategy_atuin() {
|
_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
|
if [ -n "${ZSH_AUTOSUGGEST_STRATEGY:-}" ]; then
|
||||||
|
Reference in New Issue
Block a user