@@ -39,12 +39,12 @@ in
3939
4040 patterns = mkOption {
4141 default = [];
42− type = types.listOf(types.listOf(types.string));
42+ type = types.attrsOf types.string;
4343
4444 example = literalExample ''
45− [
46− ["rm -rf *" "fg=white,bold,bg=red"]
47− ]
45+ {
46+ "rm -rf *" = "fg=white,bold,bg=red";
47+ }
4848 '';
4949
5050 description = ''
@@ -67,14 +67,17 @@ in
6767 "ZSH_HIGHLIGHT_HIGHLIGHTERS=(${concatStringsSep " " cfg.highlighters})"
6868 }
6969
70− ${optionalString (length(cfg.patterns) > 0)
71− (assert(elem "pattern" cfg.highlighters); (foldl (
72− a: b:
73− assert(length(b) == 2); ''
74− ${a}
75− ZSH_HIGHLIGHT_PATTERNS+=('${elemAt b 0}' '${elemAt b 1}')
76− ''
77− ) "") cfg.patterns)
70+ ${let
71+ n = attrNames cfg.patterns;
72+ in
73+ optionalString (length(n) > 0)
74+ (assert(elem "pattern" cfg.highlighters); (foldl (
75+ a: b:
76+ ''
77+ ${a}
78+ ZSH_HIGHLIGHT_PATTERNS+=('${b}' '${attrByPath [b] "" cfg.patterns}')
79+ ''
80+ ) "") n)
7881 }
7982 '';
8083 };