From 356324b341f80290a2e04f87713bcee3b679da50 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Mon, 1 Jan 2024 19:47:34 +0000 Subject: feat: integrate with zsh-autosuggestions (#1479) * feat: integrate with zsh-autosuggestions * Update atuin/src/shell/atuin.zsh Co-authored-by: Patrick Jackson * Update atuin/src/shell/atuin.zsh Co-authored-by: Patrick Jackson * feedback --------- Co-authored-by: Patrick Jackson --- atuin/src/shell/atuin.zsh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/atuin/src/shell/atuin.zsh b/atuin/src/shell/atuin.zsh index afff2d33..7091382a 100644 --- a/atuin/src/shell/atuin.zsh +++ b/atuin/src/shell/atuin.zsh @@ -9,6 +9,15 @@ # Source this in your ~/.zshrc autoload -U add-zsh-hook + +# If zsh-autosuggestions is installed, configure it to use Atuin's search. If +# you'd like to override this, then add your config after the $(atuin init zsh) +# in your .zshrc +_zsh_autosuggest_strategy_atuin() { + suggestion=$(atuin search --cmd-only --limit 1 --search-mode prefix "$1") +} +ZSH_AUTOSUGGEST_STRATEGY=("atuin" "${ZSH_AUTOSUGGEST_STRATEGY[@]}") + export ATUIN_SESSION=$(atuin uuid) _atuin_preexec() { -- cgit v1.3.1