From 098bd272492b32c8fc19c1034c9cf09befc5d2ff Mon Sep 17 00:00:00 2001 From: Mrid22 Date: Mon, 23 Feb 2026 19:35:32 +0200 Subject: [PATCH] modules/zsh: added more options to configure completins New stuff: option for case insensitive completion option to add zsh-completions package for extra completions option to have color for file completions fzf tab support --- modules/zsh/check.nix | 4 ++++ modules/zsh/module.nix | 22 +++++++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/modules/zsh/check.nix b/modules/zsh/check.nix index ce1144d..424efe5 100644 --- a/modules/zsh/check.nix +++ b/modules/zsh/check.nix @@ -13,6 +13,10 @@ let hdon = "hyprctl dispatch dpms on"; ls = "eza --icons"; }; + completion = { + enable = true; + caseInsensitive = true; + }; env = { NH_OS_FLAKE = "~/nixos-config"; }; diff --git a/modules/zsh/module.nix b/modules/zsh/module.nix index 39b0bf8..2b3b699 100644 --- a/modules/zsh/module.nix +++ b/modules/zsh/module.nix @@ -82,6 +82,22 @@ in description = "Initialization commands to run when completion is enabled."; type = lib.types.lines; }; + extraCompletions = lib.mkOption { + type = lib.types.bool; + default = false; + description = "enable to add zsh-completions package, it has extra completions for other tools"; + }; + colors = lib.mkOption { + type = lib.types.bool; + default = false; + description = "make the completions colorful (as if you were using ls --color)"; + }; + caseInsensitive = lib.mkOption { + type = lib.types.bool; + default = true; + description = "when enabled, makes the completion case insensitive."; + }; + fuzzySearch = lib.mkEnableOption "fuzzy-completion"; }; autoSuggestions = { @@ -200,6 +216,8 @@ in "# Completion" (lib.optionalString cfg.completion.enable cfg.completion.init) + (lib.optionalString cfg.completion.caseInsensitive "zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' ") + (lib.optionalString cfg.completion.colors "zstyle ':completion:*' list-colors \"$\{(s.:.)LS_COLORS\}\" ") "#Autosuggestions" (lib.optionalString cfg.autoSuggestions.enable '' @@ -250,7 +268,9 @@ in ++ lib.optional ing.zoxide.enable ing.zoxide.package ++ lib.optional ing.oh-my-posh.enable ing.oh-my-posh.package ++ lib.optional ing.starship.enable ing.starship.package - ++ lib.optional cfg.completion.enable config.pkgs.nix-zsh-completions; + ++ lib.optional cfg.completion.enable config.pkgs.nix-zsh-completions + ++ lib.optional cfg.completion.extraCompletions config.pkgs.zsh-completions + ++ lib.optional cfg.completion.fuzzySearch config.pkgs.zsh-fzf-tab; flags = { "--histfcntllock" = true;