nvim_config/lua/config/treesitter.lua

58 lines
2.2 KiB
Lua

require('nvim-treesitter.configs').setup {
autotag = {
enable = true,
},
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
incremental_selection = {
enable = true,
keymaps = {
init_selection = "gnn",
node_incremental = "grn",
scope_incremental = "grc",
node_decremental = "grm",
},
},
indent = {
enable = true
},
}
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
parser_config.hare = {
install_info = {
-- url = 'https://git.sr.ht/~ecmma/tree-sitter-hare', -- local path or git repo
url = '/home/leo/.config/nvim/deps/tree-sitter-hare',
files = { "src/parser.c" },
-- optional entries:
-- branch = "main", -- default branch in case of git repo if different from master
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 = "ha", -- if filetype does not match the parser name
}
vim.treesitter.language.register('hare', 'hare')
-- typst syntax
-- parser_config.typst = {
-- install_info = {
-- url = "~/code/typst/tree-sitter-typst", -- local path or git repo
-- files = {"src/parser.c", "src/scanner.cc"}, -- note that some parsers also require src/scanner.c or src/scanner.cc
-- -- optional entries:
-- -- branch = "main", -- default branch in case of git repo if different from master
-- generate_requires_npm = true, -- if stand-alone parser without npm dependencies
-- requires_generate_from_grammar = true, -- if folder contains pre-generated src/parser.c
-- },
-- filetype = "typ", -- if filetype does not match the parser name
-- }
--
-- vim.treesitter.language.register('typst', 'typ')