mirror of
https://github.com/nix-community/home-manager
synced 2024-12-27 12:19:48 +01:00
zsh: add patterns option to syntax-highlighting
This commit is contained in:
parent
b004e47e03
commit
c781b28add
2 changed files with 16 additions and 0 deletions
|
@ -236,6 +236,16 @@ let
|
|||
'';
|
||||
};
|
||||
|
||||
patterns = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
example = { "rm -rf *" = "fg=white,bold,bg=red"; };
|
||||
description = ''
|
||||
Custom syntax highlighting for user-defined patterns.
|
||||
Reference: <https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/pattern.md>
|
||||
'';
|
||||
};
|
||||
|
||||
styles = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = {};
|
||||
|
@ -673,6 +683,11 @@ in
|
|||
(name: value: "ZSH_HIGHLIGHT_STYLES+=(${lib.escapeShellArg name} ${lib.escapeShellArg value})")
|
||||
cfg.syntaxHighlighting.styles
|
||||
)}
|
||||
${lib.concatStringsSep "\n" (
|
||||
lib.mapAttrsToList
|
||||
(name: value: "ZSH_HIGHLIGHT_PATTERNS+=(${lib.escapeShellArg name} ${lib.escapeShellArg value})")
|
||||
cfg.syntaxHighlighting.patterns
|
||||
)}
|
||||
'')
|
||||
|
||||
(optionalString (cfg.historySubstringSearch.enable or false)
|
||||
|
|
|
@ -11,6 +11,7 @@ with lib;
|
|||
package = pkgs.hello;
|
||||
highlighters = [ "brackets" "pattern" "cursor" ];
|
||||
styles.comment = "fg=#6c6c6c";
|
||||
patterns."rm -rf *" = "fg=white,bold,bg=red";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue