New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
programs.zsh.syntax-highlighting: support custom highlighting patterns #25323
Conversation
since only one of the linux/nix jobs fails: can someone tell whether it's related? |
|
||
patterns = mkOption { | ||
default = []; | ||
type = types.listOf(types.listOf(types.string)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add an example here
@Mic92 added example and did a fixup into the previous commit :-) |
Thanks! |
This is great! Would it, perhaps, make a bit more sense to make the option take an attr-set, though? {
# ...
programs.zsh = {
enable = true;
syntax-highlighting = {
enable = true;
highlighters = [ "main" "pattern" ];
patterns = {
"rm -rf *" = "fg=white,bold,bg=red";
};
};
};
} Presumably, the pattern should be unique anyway. |
good point, I solved it by writing assertion expressions.
I might have some time to work on that at the end of the week :-)
… On 2 May 2017, at 5:53 PM, Charles Strahan ***@***.***> wrote:
This is great!
Would it, perhaps, make a bit more sense to make the option take an attr-set, though?
{
# ...
programs.zsh = {
enable = true;
syntax-highlighting = {
enable = true;
highlighters = [ "main" "pattern" ];
patterns = {
"rm -rf *" = "fg=white,bold,bg=red";
};
};
};
}
Presumably, the pattern should be unique anyway.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
…n recursive lists for patterns The idea has been described here: #25323 (comment) (cherry picked from commit 0925f79)
…n recursive lists for patterns The idea has been described here: NixOS#25323 (comment) (cherry picked from commit 0925f79)
Motivation for this change
Last week I improved several parts of the ZSH module. However I didn't find enough time to implement custom pattern support for
zsh-syntax-highlighting
which I managed to do now.I checked all configurations using the following command:
It works fine when using a configuration like this:
highlighters
option doesn't contain the pattern highlighter:nix
doesn't know tuples, so I had to write an assertion to ensure that only two elements are present in the list which represents one highlight pattern):Things done
(nix.useSandbox on NixOS,
or option
build-use-sandbox
innix.conf
on non-NixOS)
nix-shell -p nox --run "nox-review wip"
./result/bin/
)