Skip to content

Commit 33cc70b

Browse files
committed
treesitter: move autogroup definition to augroup module
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I1a2f5e47b4d9457a91a84802944ea06f6a6a6964
1 parent 8050617 commit 33cc70b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

modules/plugins/treesitter/config.nix

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ in {
2121

2222
treesitter.grammars = optionals cfg.addDefaultGrammars cfg.defaultGrammars;
2323

24-
pluginRC.treesitter-autocommands = entryAfter ["basic"] ''
25-
vim.api.nvim_create_augroup("nvf_treesitter", { clear = true })
24+
# Define the autogroup for treesitter here rather than in the Lua snippet
25+
# to allow overriding more easily. Should be highly unlikely that a user
26+
# wants to override, but not impossible.
27+
augroups = [
28+
{
29+
enable = true;
30+
name = "nvf_treesitter";
31+
clear = true;
32+
}
33+
];
2634

35+
pluginRC.treesitter-autocommands = entryAfter ["basic"] ''
2736
${lib.optionalString cfg.highlight.enable ''
2837
-- Enable treesitter highlighting for all filetypes
2938
vim.api.nvim_create_autocmd("FileType", {
@@ -54,6 +63,7 @@ in {
5463
callback = function()
5564
vim.wo[0][0].foldmethod = "expr"
5665
vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
66+
5767
-- This is optional, but is set rather as a sane default.
5868
-- If unset, opened files will be folded by automatically as
5969
-- the files are opened

0 commit comments

Comments
 (0)