nvim_config/lua/config/treesitter.lua

44 lines
1.6 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
}
local ft_to_parser = require "nvim-treesitter.parsers".filetype_to_parsername
ft_to_parser.hare = "hare"