@@ -36,6 +36,24 @@ in
3636 https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
3737 '';
3838 };
39+
40+ patterns = mkOption {
41+ default = [];
42+ type = types.listOf(types.listOf(types.string));
43+
44+ example = literalExample ''
45+ [
46+ ["rm -rf *" "fg=white,bold,bg=red"]
47+ ]
48+ '';
49+
50+ description = ''
51+ Specifies custom patterns to be highlighted by zsh-syntax-highlighting.
52+
53+ Please refer to the docs for more information about the usage:
54+ https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/pattern.md
55+ '';
56+ };
3957 };
4058 };
4159
@@ -48,6 +66,16 @@ in
4866 ${optionalString (length(cfg.highlighters) > 0)
4967 "ZSH_HIGHLIGHT_HIGHLIGHTERS=(${concatStringsSep " " cfg.highlighters})"
5068 }
69+
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)
78+ }
5179 '';
5280 };
5381 }