From b5b2b1ac63458357e205bcb2df2d0840a2acca13 Mon Sep 17 00:00:00 2001 From: Danil Suetin Date: Fri, 19 Apr 2024 15:05:08 +0500 Subject: [PATCH] helix: add ignores option --- modules/programs/helix.nix | 13 +++++++++++++ tests/modules/programs/helix/example-settings.nix | 5 +++++ tests/modules/programs/helix/ignore-expected | 2 ++ 3 files changed, 20 insertions(+) create mode 100644 tests/modules/programs/helix/ignore-expected diff --git a/modules/programs/helix.nix b/modules/programs/helix.nix index 9c5519f3..96c5bdbf 100644 --- a/modules/programs/helix.nix +++ b/modules/programs/helix.nix @@ -96,6 +96,16 @@ in { ''; }; + ignores = mkOption { + type = types.listOf types.str; + default = [ ]; + example = [ ".build/" "!.gitignore" ]; + description = '' + List of paths that should be globally ignored for file picker. + Supports the usual ignore and negative ignore (unignore) rules used in `.gitignore` files. + ''; + }; + themes = mkOption { type = types.attrsOf tomlFormat.type; default = { }; @@ -195,6 +205,9 @@ in { "helix/languages.toml" = mkIf (cfg.languages != { }) { source = tomlFormat.generate "helix-languages-config" cfg.languages; }; + "helix/ignore" = mkIf (cfg.ignores != [ ]) { + text = concatStringsSep "\n" cfg.ignores + "\n"; + }; }; themes = (mapAttrs' (n: v: diff --git a/tests/modules/programs/helix/example-settings.nix b/tests/modules/programs/helix/example-settings.nix index 86c6766a..c60883a1 100644 --- a/tests/modules/programs/helix/example-settings.nix +++ b/tests/modules/programs/helix/example-settings.nix @@ -43,6 +43,8 @@ with lib; }]; }; + ignores = [ ".build/" "!.gitignore" ]; + themes = { base16 = let transparent = "none"; @@ -131,6 +133,9 @@ with lib; assertFileContent \ home-files/.config/helix/languages.toml \ ${./languages-expected.toml} + assertFileContent \ + home-files/.config/helix/ignore \ + ${./ignore-expected} assertFileContent \ home-files/.config/helix/themes/base16.toml \ ${./theme-base16-expected.toml} diff --git a/tests/modules/programs/helix/ignore-expected b/tests/modules/programs/helix/ignore-expected new file mode 100644 index 00000000..fe1c7398 --- /dev/null +++ b/tests/modules/programs/helix/ignore-expected @@ -0,0 +1,2 @@ +.build/ +!.gitignore