Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4a35514eb72b
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d07ad26bfde0
Choose a head ref
  • 3 commits
  • 1 file changed
  • 2 contributors

Commits on May 31, 2017

  1. programs.zsh.syntaxHighlighting: refactor to use attr sets rather tha…

    …n recursive lists for patterns
    
    The idea has been described here: #25323 (comment)
    Ma27 committed May 31, 2017
    Copy the full SHA
    0925f79 View commit details
  2. Copy the full SHA
    c4e4071 View commit details

Commits on Jun 3, 2017

  1. Merge pull request #26229 from Ma27/refactor/use-attr-set-for-syntax-…

    …highlighting-patterns
    
    programs.zsh.syntaxHighlighting: refactor to use attr sets rather than recursive lists for patterns
    Mic92 authored Jun 3, 2017
    Copy the full SHA
    d07ad26 View commit details
Showing with 16 additions and 19 deletions.
  1. +16 −19 nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
35 changes: 16 additions & 19 deletions nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
Original file line number Diff line number Diff line change
@@ -8,13 +8,7 @@ in
{
options = {
programs.zsh.syntaxHighlighting = {
enable = mkOption {
default = false;
type = types.bool;
description = ''
Enable zsh-syntax-highlighting.
'';
};
enable = mkEnableOption "zsh-syntax-highlighting";

highlighters = mkOption {
default = [ "main" ];
@@ -39,12 +33,12 @@ in

patterns = mkOption {
default = [];
type = types.listOf(types.listOf(types.string));
type = types.attrsOf types.string;

example = literalExample ''
[
["rm -rf *" "fg=white,bold,bg=red"]
]
{
"rm -rf *" = "fg=white,bold,bg=red";
}
'';

description = ''
@@ -67,14 +61,17 @@ in
"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)
${let
n = attrNames cfg.patterns;
in
optionalString (length(n) > 0)
(assert(elem "pattern" cfg.highlighters); (foldl (
a: b:
''
${a}
ZSH_HIGHLIGHT_PATTERNS+=('${b}' '${attrByPath [b] "" cfg.patterns}')
''
) "") n)
}
'';
};