Skip to content

Commit

Permalink
helix: add ignores option
Browse files Browse the repository at this point in the history
  • Loading branch information
dani0854 authored Apr 19, 2024
1 parent 8ff7bb3 commit b5b2b1a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions modules/programs/helix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = { };
Expand Down Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions tests/modules/programs/helix/example-settings.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ with lib;
}];
};

ignores = [ ".build/" "!.gitignore" ];

themes = {
base16 = let
transparent = "none";
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions tests/modules/programs/helix/ignore-expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.build/
!.gitignore

0 comments on commit b5b2b1a

Please sign in to comment.