From 4b5dbd161a7a124b997e5394abe30d357e87e966 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Tue, 24 Jun 2025 00:06:33 +0200 Subject: [PATCH] zsh:autosuggestions: Switch to history strategy I don't feel as if I'm actively benefiting from match_prev_cmd and it definitely makes my prompt slower. (One could probably make it faster by pre-calculating the history events matching the (previously) executed command in a preexec zsh-hook and then comparing each successor to the currently typed command instead of repeating all the work every time BUFFER changes) With this change my fork is not needed anymore, so switch back to zsh-users' repo and update it while at it. This effectively reverts 77b2d63341e7 ("zsh:autosuggestions: Use own fork for now"). --- .../90-external-plugins/20-autosuggestions.config.zsh | 11 +++-------- .gitmodules | 2 +- .local/share/zsh/plugins/zsh-autosuggestions | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/.config/zsh/zshrc.d/90-external-plugins/20-autosuggestions.config.zsh b/.config/zsh/zshrc.d/90-external-plugins/20-autosuggestions.config.zsh index 7f70320..ce75dbb 100644 --- a/.config/zsh/zshrc.d/90-external-plugins/20-autosuggestions.config.zsh +++ b/.config/zsh/zshrc.d/90-external-plugins/20-autosuggestions.config.zsh @@ -1,13 +1,8 @@ # Set suggestions strategy -# match_prev_cmd: -# Chooses the most recent match from history whose preceding item matches -# the most recently executed command. -# Won't work as expected with HIST_IGNORE_ALL_DUPS or HIST_EXPIRE_DUPS_FIRST +# history: +# Chooses the most recent match from history. # completion: # Chooses a suggestion based on what tab-completion would suggest. -ZSH_AUTOSUGGEST_STRATEGY=(match_prev_cmd completion) - -ZSH_AUTOSUGGEST_MATCH_NUM_PREV_CMDS=2 -ZSH_AUTOSUGGEST_MATCH_PREV_MAX_CMDS=-1 +ZSH_AUTOSUGGEST_STRATEGY=(history completion) # vim: ft=zsh diff --git a/.gitmodules b/.gitmodules index b0d73c8..f804588 100644 --- a/.gitmodules +++ b/.gitmodules @@ -126,7 +126,7 @@ url = https://github.com/sickill/stderred [submodule "zsh-autosuggestions"] path = .local/share/zsh/plugins/zsh-autosuggestions - url = https://github.com/druckdev/zsh-autosuggestions + url = https://github.com/zsh-users/zsh-autosuggestions [submodule "zsh-syntax-highlighting"] path = .local/share/zsh/plugins/zsh-syntax-highlighting url = https://github.com/zsh-users/zsh-syntax-highlighting diff --git a/.local/share/zsh/plugins/zsh-autosuggestions b/.local/share/zsh/plugins/zsh-autosuggestions index 0d07421..e52ee8c 160000 --- a/.local/share/zsh/plugins/zsh-autosuggestions +++ b/.local/share/zsh/plugins/zsh-autosuggestions @@ -1 +1 @@ -Subproject commit 0d07421b4267b9a849c38e7a2a93c015946965e3 +Subproject commit e52ee8ca55bcc56a17c828767a3f98f22a68d4eb