diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2017-05-01 22:23:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-01 22:23:36 +0200 |
commit | 4c576fd9469201a866e06db91251e9e710bf82fe (patch) | |
tree | ece97aa31f247841ce50c2e78a19a36fcf0b144b | |
parent | b99007de810c3fc03615367dde23fda6e4719574 (diff) | |
parent | f6e612bb8f75b1dc8516339a08c9edd4c05d0964 (diff) | |
download | nixpkgs-4c576fd9469201a866e06db91251e9e710bf82fe.tar nixpkgs-4c576fd9469201a866e06db91251e9e710bf82fe.tar.gz nixpkgs-4c576fd9469201a866e06db91251e9e710bf82fe.tar.bz2 nixpkgs-4c576fd9469201a866e06db91251e9e710bf82fe.tar.lz nixpkgs-4c576fd9469201a866e06db91251e9e710bf82fe.tar.xz nixpkgs-4c576fd9469201a866e06db91251e9e710bf82fe.tar.zst nixpkgs-4c576fd9469201a866e06db91251e9e710bf82fe.zip |
Merge pull request #25323 from Ma27/zsh/support-pattern-highlighters
programs.zsh.syntax-highlighting: support custom highlighting patterns
-rw-r--r-- | nixos/modules/programs/zsh/zsh-syntax-highlighting.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix b/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix index fde241ca3ce..e5246bb4260 100644 --- a/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix +++ b/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix @@ -36,6 +36,24 @@ in https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md ''; }; + + patterns = mkOption { + default = []; + type = types.listOf(types.listOf(types.string)); + + example = literalExample '' + [ + ["rm -rf *" "fg=white,bold,bg=red"] + ] + ''; + + description = '' + Specifies custom patterns to be highlighted by zsh-syntax-highlighting. + + Please refer to the docs for more information about the usage: + https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/pattern.md + ''; + }; }; }; @@ -48,6 +66,16 @@ in ${optionalString (length(cfg.highlighters) > 0) "ZSH_HIGHLIGHT_HIGHLIGHTERS=(${concatStringsSep " " cfg.highlighters})" } + + ${optionalString (length(cfg.patterns) > 0) + (assert(elem "pattern" cfg.highlighters); (foldl ( + a: b: + assert(length(b) == 2); '' + ${a} + ZSH_HIGHLIGHT_PATTERNS+=('${elemAt b 0}' '${elemAt b 1}') + '' + ) "") cfg.patterns) + } ''; }; } |