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.
This commit is contained in:
Aaron Pietscher 2023-07-15 11:49:12 +02:00 committed by GitHub
parent c1cdce3d89
commit 5598567489
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -613,7 +613,7 @@ in
source ${cfg.syntaxHighlighting.package}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh source ${cfg.syntaxHighlighting.package}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
${lib.concatStringsSep "\n" ( ${lib.concatStringsSep "\n" (
lib.mapAttrsToList 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 cfg.syntaxHighlighting.styles
)} )}
'') '')

View file

@ -17,7 +17,7 @@ with lib;
nmt.script = '' nmt.script = ''
assertFileContains home-files/.zshrc "source ${pkgs.hello}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" 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')"
''; '';
}; };
} }