1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-01 00:39:45 +01:00

zsh: set autosuggestion color

Before, one could only toggle autosuggestion. This allows to set the
style as well.
This commit is contained in:
Matthieu Coudron 2023-11-26 01:09:47 +01:00 committed by Robert Helgesson
parent dc2f3812b4
commit 3ad5c12f3c
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED

View file

@ -252,6 +252,7 @@ in
{
imports = [
(mkRenamedOptionModule [ "programs" "zsh" "enableAutosuggestions" ] [ "programs" "zsh" "autosuggestion" "enable" ])
(mkRenamedOptionModule [ "programs" "zsh" "enableSyntaxHighlighting" ] [ "programs" "zsh" "syntaxHighlighting" "enable" ])
(mkRenamedOptionModule [ "programs" "zsh" "zproof" ] [ "programs" "zsh" "zprof" ])
];
@ -352,11 +353,6 @@ in
type = types.lines;
};
enableAutosuggestions = mkOption {
default = false;
description = "Enable zsh autosuggestions";
};
zprof.enable = mkOption {
default = false;
description = ''
@ -376,6 +372,24 @@ in
description = "Options related to zsh-history-substring-search.";
};
autosuggestion = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable zsh autosuggestions";
};
highlight = mkOption {
type = types.nullOr types.str;
default = null;
example = "fg=#ff00ff,bg=cyan,bold,underline";
description = ''
Custom styles for autosuggestion highlighting. See
{manpage}`zshzle(1)` for syntax.
'';
};
};
history = mkOption {
type = historyModule;
default = {};
@ -582,13 +596,16 @@ in
# as all $fpath entries will be traversed again.
${optionalString (cfg.enableCompletion && !cfg.oh-my-zsh.enable && !cfg.prezto.enable)
cfg.completionInit
}
}''
${optionalString cfg.enableAutosuggestions
"source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
}
(optionalString cfg.autosuggestion.enable ''
source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh
'')
(optionalString (cfg.autosuggestion.enable && cfg.autosuggestion.highlight != null) ''
AUTOSUGGESTION_HIGHLIGHT_COLOR="${cfg.autosuggestion.highlight}"
'')
${optionalString cfg.oh-my-zsh.enable ''
(optionalString cfg.oh-my-zsh.enable ''
# oh-my-zsh extra settings for plugins
${cfg.oh-my-zsh.extraConfig}
# oh-my-zsh configuration generated by NixOS
@ -602,8 +619,9 @@ in
"ZSH_THEME=\"${cfg.oh-my-zsh.theme}\""
}
source $ZSH/oh-my-zsh.sh
''}
'')
''
${optionalString cfg.prezto.enable
(builtins.readFile "${pkgs.zsh-prezto}/share/zsh-prezto/runcoms/zshrc")}