mirror of
https://github.com/NotAShelf/nvf.git
synced 2026-02-03 10:25:52 +00:00
treesitter: move autogroup definition to augroup module
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I1a2f5e47b4d9457a91a84802944ea06f6a6a6964
This commit is contained in:
parent
8050617656
commit
33cc70b4db
1 changed files with 12 additions and 2 deletions
|
|
@ -21,9 +21,18 @@ in {
|
||||||
|
|
||||||
treesitter.grammars = optionals cfg.addDefaultGrammars cfg.defaultGrammars;
|
treesitter.grammars = optionals cfg.addDefaultGrammars cfg.defaultGrammars;
|
||||||
|
|
||||||
pluginRC.treesitter-autocommands = entryAfter ["basic"] ''
|
# Define the autogroup for treesitter here rather than in the Lua snippet
|
||||||
vim.api.nvim_create_augroup("nvf_treesitter", { clear = true })
|
# to allow overriding more easily. Should be highly unlikely that a user
|
||||||
|
# wants to override, but not impossible.
|
||||||
|
augroups = [
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
name = "nvf_treesitter";
|
||||||
|
clear = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
pluginRC.treesitter-autocommands = entryAfter ["basic"] ''
|
||||||
${lib.optionalString cfg.highlight.enable ''
|
${lib.optionalString cfg.highlight.enable ''
|
||||||
-- Enable treesitter highlighting for all filetypes
|
-- Enable treesitter highlighting for all filetypes
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
|
@ -54,6 +63,7 @@ in {
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.wo[0][0].foldmethod = "expr"
|
vim.wo[0][0].foldmethod = "expr"
|
||||||
vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||||
|
|
||||||
-- This is optional, but is set rather as a sane default.
|
-- This is optional, but is set rather as a sane default.
|
||||||
-- If unset, opened files will be folded by automatically as
|
-- If unset, opened files will be folded by automatically as
|
||||||
-- the files are opened
|
-- the files are opened
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue