Skip to content

Commit c954a7c

Browse files
authored
Merge pull request #136 from Mrid22/better-completions
modules/zsh: more settings to costumize completions
2 parents 663b60e + 098bd27 commit c954a7c

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

modules/zsh/check.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ let
1313
hdon = "hyprctl dispatch dpms on";
1414
ls = "eza --icons";
1515
};
16+
completion = {
17+
enable = true;
18+
caseInsensitive = true;
19+
};
1620
env = {
1721
NH_OS_FLAKE = "~/nixos-config";
1822
};

modules/zsh/module.nix

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,22 @@ in
8282
description = "Initialization commands to run when completion is enabled.";
8383
type = lib.types.lines;
8484
};
85+
extraCompletions = lib.mkOption {
86+
type = lib.types.bool;
87+
default = false;
88+
description = "enable to add zsh-completions package, it has extra completions for other tools";
89+
};
90+
colors = lib.mkOption {
91+
type = lib.types.bool;
92+
default = false;
93+
description = "make the completions colorful (as if you were using ls --color)";
94+
};
95+
caseInsensitive = lib.mkOption {
96+
type = lib.types.bool;
97+
default = true;
98+
description = "when enabled, makes the completion case insensitive.";
99+
};
100+
fuzzySearch = lib.mkEnableOption "fuzzy-completion";
85101
};
86102

87103
autoSuggestions = {
@@ -200,6 +216,8 @@ in
200216

201217
"# Completion"
202218
(lib.optionalString cfg.completion.enable cfg.completion.init)
219+
(lib.optionalString cfg.completion.caseInsensitive "zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' ")
220+
(lib.optionalString cfg.completion.colors "zstyle ':completion:*' list-colors \"$\{(s.:.)LS_COLORS\}\" ")
203221

204222
"#Autosuggestions"
205223
(lib.optionalString cfg.autoSuggestions.enable ''
@@ -250,7 +268,9 @@ in
250268
++ lib.optional ing.zoxide.enable ing.zoxide.package
251269
++ lib.optional ing.oh-my-posh.enable ing.oh-my-posh.package
252270
++ lib.optional ing.starship.enable ing.starship.package
253-
++ lib.optional cfg.completion.enable config.pkgs.nix-zsh-completions;
271+
++ lib.optional cfg.completion.enable config.pkgs.nix-zsh-completions
272+
++ lib.optional cfg.completion.extraCompletions config.pkgs.zsh-completions
273+
++ lib.optional cfg.completion.fuzzySearch config.pkgs.zsh-fzf-tab;
254274

255275
flags = {
256276
"--histfcntllock" = true;

0 commit comments

Comments
 (0)