From 559856748982588a9eda6bfb668450ebcf006ccd Mon Sep 17 00:00:00 2001 From: Aaron Pietscher <62202958+aaron-p1@users.noreply.github.com> Date: Sat, 15 Jul 2023 11:49:12 +0200 Subject: [PATCH] zsh: fix custom syntax highlighting styles (#4236) Previously, lines in .zshrc were added with quotes in keys (e.g. ZSH_HIGHLIGHT_STYLES['comment']='fg=#6c6c6c'). However, zsh considered these quotes to be part of the key, so the "comment" key remained unchanged. --- modules/programs/zsh.nix | 2 +- tests/modules/programs/zsh/syntax-highlighting.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 34df1a76..d69ea7c3 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -613,7 +613,7 @@ in source ${cfg.syntaxHighlighting.package}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ${lib.concatStringsSep "\n" ( lib.mapAttrsToList - (name: value: "ZSH_HIGHLIGHT_STYLES[${lib.escapeShellArg name}]=${lib.escapeShellArg value}") + (name: value: "ZSH_HIGHLIGHT_STYLES+=(${lib.escapeShellArg name} ${lib.escapeShellArg value})") cfg.syntaxHighlighting.styles )} '') diff --git a/tests/modules/programs/zsh/syntax-highlighting.nix b/tests/modules/programs/zsh/syntax-highlighting.nix index be2ad37e..73297c8c 100644 --- a/tests/modules/programs/zsh/syntax-highlighting.nix +++ b/tests/modules/programs/zsh/syntax-highlighting.nix @@ -17,7 +17,7 @@ with lib; nmt.script = '' assertFileContains home-files/.zshrc "source ${pkgs.hello}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" - assertFileContains home-files/.zshrc "ZSH_HIGHLIGHT_STYLES['comment']='fg=#6c6c6c'" + assertFileContains home-files/.zshrc "ZSH_HIGHLIGHT_STYLES+=('comment' 'fg=#6c6c6c')" ''; }; }