helix: add ignores option

This commit is contained in:
Danil Suetin 2024-04-19 15:05:08 +05:00 committed by GitHub
parent 8ff7bb3f4d
commit b5b2b1ac63
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 0 deletions

View file

@ -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 { themes = mkOption {
type = types.attrsOf tomlFormat.type; type = types.attrsOf tomlFormat.type;
default = { }; default = { };
@ -195,6 +205,9 @@ in {
"helix/languages.toml" = mkIf (cfg.languages != { }) { "helix/languages.toml" = mkIf (cfg.languages != { }) {
source = tomlFormat.generate "helix-languages-config" 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: themes = (mapAttrs' (n: v:

View file

@ -43,6 +43,8 @@ with lib;
}]; }];
}; };
ignores = [ ".build/" "!.gitignore" ];
themes = { themes = {
base16 = let base16 = let
transparent = "none"; transparent = "none";
@ -131,6 +133,9 @@ with lib;
assertFileContent \ assertFileContent \
home-files/.config/helix/languages.toml \ home-files/.config/helix/languages.toml \
${./languages-expected.toml} ${./languages-expected.toml}
assertFileContent \
home-files/.config/helix/ignore \
${./ignore-expected}
assertFileContent \ assertFileContent \
home-files/.config/helix/themes/base16.toml \ home-files/.config/helix/themes/base16.toml \
${./theme-base16-expected.toml} ${./theme-base16-expected.toml}

View file

@ -0,0 +1,2 @@
.build/
!.gitignore