about summary refs log tree commit diff
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authorGraham Christensen <graham@grahamc.com>2019-01-29 12:27:43 -0500
committerGitHub <noreply@github.com>2019-01-29 12:27:43 -0500
commit0fe1645987ac44dff60b3d32c23030c6e4631e07 (patch)
tree1d6e80f623f643efbff0849fa9eb5a5b3ef0341e /nixos/modules/programs
parentf072cfe1ebff79efaa409258a38646a62c94dbff (diff)
parent420b83b29b3421824cebdd6b9cbe73d5cc27d50f (diff)
downloadnixlib-0fe1645987ac44dff60b3d32c23030c6e4631e07.tar
nixlib-0fe1645987ac44dff60b3d32c23030c6e4631e07.tar.gz
nixlib-0fe1645987ac44dff60b3d32c23030c6e4631e07.tar.bz2
nixlib-0fe1645987ac44dff60b3d32c23030c6e4631e07.tar.lz
nixlib-0fe1645987ac44dff60b3d32c23030c6e4631e07.tar.xz
nixlib-0fe1645987ac44dff60b3d32c23030c6e4631e07.tar.zst
nixlib-0fe1645987ac44dff60b3d32c23030c6e4631e07.zip
Merge pull request #53245 from Izorkin/zsh-syntaxHighlighting
zsh.syntaxHighlighting: add option to customize styles
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r--nixos/modules/programs/zsh/zsh-syntax-highlighting.nix22
1 files changed, 22 insertions, 0 deletions
diff --git a/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix b/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
index e7cf17c2c00c..89087a229eb7 100644
--- a/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
+++ b/nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
@@ -48,6 +48,23 @@ in
           https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/pattern.md
         '';
       };
+      styles = mkOption {
+        default = {};
+        type = types.attrsOf types.string;
+
+        example = literalExample ''
+          {
+            "alias" = "fg=magenta,bold";
+          }
+        '';
+
+        description = ''
+          Specifies custom styles 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/main.md
+        '';
+      };
     };
   };
 
@@ -73,6 +90,11 @@ in
             pattern: design:
             "ZSH_HIGHLIGHT_PATTERNS+=('${pattern}' '${design}')"
           ) cfg.patterns)
+        ++ optionals (length(attrNames cfg.styles) > 0)
+          (mapAttrsToList (
+            styles: design:
+            "ZSH_HIGHLIGHT_STYLES[${styles}]='${design}'"
+          ) cfg.styles)
       );
   };
 }