treesitter: allow setting of filetype pattern and excludes for indent

This commit is contained in:
Matthias Putz 2026-03-24 22:19:48 +01:00
commit d30ba87023
3 changed files with 41 additions and 4 deletions

View file

@ -4,7 +4,7 @@
...
}: let
inherit (lib.options) mkOption mkEnableOption literalExpression;
inherit (lib.types) listOf nullOr package bool;
inherit (lib.types) listOf nullOr package bool str oneOf;
in {
options.vim.treesitter = {
enable = mkEnableOption "treesitter, also enabled automatically through language options";
@ -64,7 +64,28 @@ in {
'';
};
indent = {enable = mkEnableOption "indentation with treesitter" // {default = true;};};
indent = {
enable = mkEnableOption "indentation with treesitter" // {default = true;};
pattern = mkOption {
type = oneOf [str (listOf str)];
default = "*";
example = literalExpression ''["lua" "nix"]'';
description = ''
Specify the filetype pattern(s) for which the treesitter indentation should be used.
See {command}`:h autocmd-pattern`.
'';
};
excludes = mkOption {
type = listOf str;
default = [];
example = literalExpression ''["haskell", "purescript"]'';
description = ''
Exclude the listed filetypes from using treesitter indentation.
'';
};
};
highlight = {enable = mkEnableOption "highlighting with treesitter" // {default = true;};};
};
}