27 lines
994 B
Lua
27 lines
994 B
Lua
return {
|
|
'nvim-treesitter/nvim-treesitter',
|
|
lazy = false,
|
|
build = ':TSUpdate',
|
|
config = function()
|
|
-- Auto launch tree-sitter
|
|
require('nvim-treesitter').get_available()
|
|
vim.api.nvim_create_autocmd('FileType', {
|
|
pattern = require('nvim-treesitter').get_available(),
|
|
callback = function(event)
|
|
-- Auto install languages
|
|
if event.match ~= require('nvim-treesitter').get_installed() then
|
|
require('nvim-treesitter').install({ event.match }):wait(3000) -- 30 sec timeout
|
|
end
|
|
-- syntax highlighting, provided by Neovim
|
|
vim.treesitter.start()
|
|
-- Use regex highlighting as well as tree-sitter
|
|
vim.bo.syntax = event.match
|
|
-- folds, provided by Neovim
|
|
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
|
|
vim.wo.foldmethod = 'expr'
|
|
-- indentation, provided by nvim-treesitter
|
|
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
|
end,
|
|
})
|
|
end
|
|
}
|