Setting up tree-sitter in Nvim
The grammar isn’t shipped with nvim-treesitter, so it has to be registered by hand. With the
nvim-treesitter master branch:
vim.filetype.add({ extension = { m2 = "macaulay2" } }) -- not needed with m2.nvim
require("nvim-treesitter.parsers").get_parser_configs().macaulay2 = {
install_info = {
url = "https://github.com/AlexanderGolys/tree-sitter-macaulay2",
files = { "src/parser.c", "src/scanner.c" },
},
filetype = "macaulay2",
}
Then install the parser:
:TSInstall macaulay2
Highlight queries live in the grammar repository’s queries/ directory and need to be on your
runtimepath under queries/macaulay2/. The Nvim plugin ships folding,
indentation and tags queries; with its parser option pointing at a local checkout of the
grammar, it does the registration and the runtimepath part for you.