From 3a7fc9cd71a844aae9c6b6bb44700cea9539bc13 Mon Sep 17 00:00:00 2001 From: Nova Leary Date: Wed, 4 Dec 2024 13:54:01 -0600 Subject: [PATCH] zsh: make autosuggest strategy accept more options Now accepts an empty list, which turns off the code so the user can manually set ZSH_AUTOSUGGEST_STRATEGY anywhere they want via any of the `*Variables` module options. --- modules/programs/zsh.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index b6e46392c..50f8055c0 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -427,6 +427,9 @@ in - `match_prev_cmd`: Like `history`, but chooses the most recent match whose preceding history item matches the most recently executed command. Note that this strategy won't work as expected with ZSH options that don't preserve the history order such as `HIST_IGNORE_ALL_DUPS` or `HIST_EXPIRE_DUPS_FIRST`. + + Setting the option to an empty list `[]` will make ZSH_AUTOSUGGESTION_STRATEGY not be set automatically, + allowing the variable to be declared in {option}`programs.zsh.localVariables` or {option}`programs.zsh.sessionVariables` ''; }; }; @@ -641,7 +644,10 @@ in (optionalString cfg.autosuggestion.enable '' source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh - ZSH_AUTOSUGGEST_STRATEGY=(${concatStringsSep " " cfg.autosuggestion.strategy}) + ${optionalString (cfg.autosuggestion.strategy != []) '' + ZSH_AUTOSUGGEST_STRATEGY=(${concatStringsSep " " cfg.autosuggestion.strategy}) + '' + } '') (optionalString (cfg.autosuggestion.enable && cfg.autosuggestion.highlight != null) '' ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="${cfg.autosuggestion.highlight}"