plugins/treesitter: update docs for custom grammar installation

This commit is contained in:
svanr 2024-12-20 21:53:14 -05:00
parent 354fc0f288
commit 9f32e25f3f

View file

@ -102,31 +102,33 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin {
# treesitter-nu-grammar = pkgs.tree-sitter-grammars.tree-sitter-nu; # treesitter-nu-grammar = pkgs.tree-sitter-grammars.tree-sitter-nu;
in in
{ {
programs.nixvim.plugins = { programs.nixvim = {
treesitter = { plugins = {
enable = true; treesitter = {
settings.indent.enable = true; enable = true;
grammarPackages = pkgs.vimPlugins.nvim-treesitter.passthru.allGrammars ++ [ settings.indent.enable = true;
treesitter-nu-grammar grammarPackages = pkgs.vimPlugins.nvim-treesitter.passthru.allGrammars ++ [
]; treesitter-nu-grammar
luaConfig.post= ];
''' luaConfig.post=
do '''
local parser_config = require("nvim-treesitter.parsers").get_parser_configs() do
-- change the following as needed local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.nu = { -- change the following as needed
install_info = { parser_config.nu = {
url = "''${treesitter-nu-grammar}", -- local path or git repo install_info = {
files = {"src/parser.c"}, -- note that some parsers also require src/scanner.c or src/scanner.cc url = "''${treesitter-nu-grammar}", -- local path or git repo
-- optional entries: files = {"src/parser.c"}, -- note that some parsers also require src/scanner.c or src/scanner.cc
-- branch = "main", -- default branch in case of git repo if different from master -- optional entries:
-- generate_requires_npm = false, -- if stand-alone parser without npm dependencies -- branch = "main", -- default branch in case of git repo if different from master
-- requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c -- generate_requires_npm = false, -- if stand-alone parser without npm dependencies
}, -- requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
filetype = "nu", -- if filetype does not match the parser name },
} filetype = "nu", -- if filetype does not match the parser name
end }
'''; end
''';
};
}; };
# Add as extra plugins so that their `queries/{language}/*.scm` get # Add as extra plugins so that their `queries/{language}/*.scm` get