1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2024-12-14 11:57:55 +00:00

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.
This commit is contained in:
Nova Leary 2024-12-04 13:54:01 -06:00 committed by GitHub
parent ad48eb25cd
commit 3a7fc9cd71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
${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}"