zsh: fix highlighter backwards compatibility

Use the module system to set the default at user prio so that existing
configs don't clear out `main`

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
Austin Horstman 2026-01-26 09:26:29 -06:00
parent c37679d37b
commit d0cdb4101f
2 changed files with 10 additions and 3 deletions

View file

@ -44,11 +44,15 @@ in
highlighters = mkOption {
type = types.listOf types.str;
default = [ "main" ];
default = [ ];
defaultText = ''[ "main" ]'';
example = [ "brackets" ];
description = ''
Highlighters to enable
See the list of highlighters: <https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md>
Note: The "main" highlighter is always included automatically.
If you'd like to exclude it, please configure with a higher priority using `mkForce`.
'';
};
@ -476,6 +480,10 @@ in
{
home.packages = [ cfg.package ] ++ lib.optional cfg.enableCompletion pkgs.nix-zsh-completions;
# NOTE: Always include "main" highlighter with normal priority.
# Option default priority will cause `main` to get dropped by customization.
programs.zsh.syntaxHighlighting.highlighters = lib.mkIf cfg.syntaxHighlighting.enable [ "main" ];
programs.zsh.initContent = lib.mkMerge [
(mkOrder 510 "typeset -U path cdpath fpath manpath")