Skip to content

Commit

Permalink
Merge pull request #909 from motheki/fast-syntax-highlighting-support
Browse files Browse the repository at this point in the history
Add support for zsh-fast-syntax-highlighting
  • Loading branch information
Enzime authored Nov 6, 2024
2 parents 0e3f3f0 + 48e5c8d commit 98e7dba
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion modules/programs/zsh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,24 @@ in
default = false;
description = "Enable zsh-syntax-highlighting.";
};

programs.zsh.enableFastSyntaxHighlighting = mkEnableOption "zsh-fast-syntax-highlighting";
};

config = mkIf cfg.enable {

assertions = [
{
assertion = !(cfg.enableSyntaxHighlighting && cfg.enableFastSyntaxHighlighting);
message = "zsh-syntax-highlighting and zsh-fast-syntax-highlighting are mutually exclusive, please disable one of them.";
}
];
environment.systemPackages =
[ # Include zsh package
pkgs.zsh
] ++ optional cfg.enableCompletion pkgs.nix-zsh-completions
++ optional cfg.enableSyntaxHighlighting pkgs.zsh-syntax-highlighting;
++ optional cfg.enableSyntaxHighlighting pkgs.zsh-syntax-highlighting
++ optional cfg.enableFastSyntaxHighlighting pkgs.zsh-fast-syntax-highlighting;

environment.pathsToLink = [ "/share/zsh" ];

Expand Down Expand Up @@ -192,6 +201,10 @@ in
"source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
}
${optionalString cfg.enableFastSyntaxHighlighting
"source ${pkgs.zsh-fast-syntax-highlighting}/share/zsh-fast-syntax-highlighting/zsh-fast-syntax-highlighting.zsh"
}
${optionalString cfg.enableFzfCompletion "source ${fzfCompletion}"}
${optionalString cfg.enableFzfGit "source ${fzfGit}"}
${optionalString cfg.enableFzfHistory "source ${fzfHistory}"}
Expand Down

0 comments on commit 98e7dba

Please sign in to comment.