forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zsh-syntax-highlighting: Add more configuration options and move to m…
…odule (NixOS#25153) * programs.zsh: factor zsh-syntax-highlighting out into its own module * programs.zsh.syntax-highlighting: add `highlighters` option * programs.zsh: document BC break introduced by moving zsh-syntax-completion into its own module
- Loading branch information
Showing
4 changed files
with
48 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
cfg = config.programs.zsh.syntax-highlighting; | ||
in | ||
{ | ||
options = { | ||
programs.zsh.syntax-highlighting = { | ||
enable = mkOption { | ||
default = false; | ||
type = types.bool; | ||
description = '' | ||
Enable zsh-syntax-highlighting. | ||
''; | ||
}; | ||
|
||
highlighters = mkOption { | ||
default = [ "main" ]; | ||
type = types.listOf(types.str); | ||
description = '' | ||
Specifies the highlighters to be used by zsh-syntax-highlighting. | ||
The following defined options can be found here: | ||
https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md | ||
''; | ||
}; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
environment.systemPackages = with pkgs; [ zsh-syntax-highlighting ]; | ||
|
||
programs.zsh.interactiveShellInit = with pkgs; with builtins; '' | ||
source ${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | ||
${optionalString (length(cfg.highlighters) > 0) | ||
"ZSH_HIGHLIGHT_HIGHLIGHTERS=(${concatStringsSep " " cfg.highlighters})" | ||
} | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters