1
0
Fork 0
chezmoi/dot_config/nvim/lua/configs/treesitter.lua
2022-11-03 15:05:24 +01:00

42 lines
1.2 KiB
Lua

local M = {}
function M.setup()
require 'nvim-treesitter.configs'.setup {
ensure_installed = 'all', -- one of "all", "maintained" (parsers with maintainers), or a list of languages
highlight = {
enable = true,
disable = { 'help' },
},
playground = { enable = true, },
yati = { enable = true, },
incremental_selection = {
enable = true,
keymaps = {
init_selection = 'gnn',
node_incremental = '+',
scope_incremental = 'grc',
node_decremental = '-',
},
},
indent = {
-- disable = { "php" },-- php indent SUCKS A LOT
enable = false,
},
}
local ts_parsers = require 'nvim-treesitter.parsers'.get_parser_configs()
ts_parsers.xml = {
install_info = {
url = 'https://github.com/dorgnarg/tree-sitter-xml', -- local path or git repo
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 = true, -- if folder contains pre-generated src/parser.c
},
filetype = 'xml', -- if filetype does not match the parser name
}
end
return M