Skip to content

Commit

Permalink
zsh: add enableSyntaxHighlighting option
Browse files Browse the repository at this point in the history
  • Loading branch information
davegallant committed Jun 27, 2021
1 parent 8d3b273 commit 99c9076
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions modules/programs/zsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ let
vicmd = "bindkey -a";
};

highlighters = {
zsh-fast-syntax-highlighting = "source ${pkgs.zsh-fast-syntax-highlighting}/share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
zsh-syntax-highlighting = "source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh";
};

stateVersion = config.home.stateVersion;

historyModule = types.submodule ({ config, ... }: {
Expand Down Expand Up @@ -290,6 +295,17 @@ in
description = "Enable zsh autosuggestions";
};

syntaxHighlighting = {
enable = mkOption {
default = false;
description = "Enable syntax highlighting";
};
highlighter = mkOption {
default = "zsh-syntax-highlighting";
description = "The package name of the highlighter";
};
};

history = mkOption {
type = historyModule;
default = {};
Expand Down Expand Up @@ -482,6 +498,10 @@ in
"source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
}
${optionalString cfg.syntaxHighlighting.enable
highlighters."${cfg.syntaxHighlighting.highlighter}"
}
# Environment variables
. "${config.home.profileDirectory}/etc/profile.d/hm-session-vars.sh"
${envVarsStr}
Expand Down

0 comments on commit 99c9076

Please sign in to comment.