dotfiles/modules/nvim/after/plugin/treesitter.lua

58 lines
1.1 KiB
Lua
Raw Normal View History

local present, treesitter = pcall(require, "nvim-treesitter.configs")
2023-02-09 16:42:53 +01:00
if not present then
return
end
2023-02-09 22:34:27 +01:00
local parsers = require("nvim-treesitter.parsers")
local parser_config = parsers.get_parser_configs()
2023-02-09 16:42:53 +01:00
parser_config.gotmpl = {
install_info = {
url = "https://github.com/ngalaiko/tree-sitter-go-template",
files = { "src/parser.c" },
},
filetype = "gotmpl",
used_by = { "gohtmltmpl", "gotexttmpl", "gotmpl", "yaml", "helm" },
}
2023-02-09 22:34:27 +01:00
local ft_to_parser = parsers.filetype_to_parsername
2023-02-09 16:42:53 +01:00
ft_to_parser.helm = "gotmpl"
treesitter.setup({
2022-10-11 07:40:50 +02:00
auto_install = true,
ignore_install = {
"phpdoc",
},
highlight = {
enable = true,
},
2022-10-17 17:13:31 +02:00
rainbow = {
enable = true,
extended_mode = true,
max_file_lines = 8192,
},
2022-10-11 07:40:50 +02:00
ensure_installed = {
"bash",
"css",
"dockerfile",
"go",
"html",
"javascript",
"json",
"lua",
"markdown",
"python",
"regex",
"rust",
"scss",
"toml",
"tsx",
"typescript",
"yaml",
},
2022-07-30 07:17:12 +02:00
})
2023-02-09 22:34:27 +01:00
vim.o.foldmethod = "expr"
vim.o.foldexpr = "nvim_treesitter#foldexpr()"
vim.o.foldenable = false