refactor(nvim): improve treesitter lazy loading

This commit is contained in:
Price Hiller 2024-02-19 07:08:54 -06:00
parent 42a51802fb
commit a6996bb086
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB

View File

@ -121,6 +121,19 @@ return {
"nvim-treesitter/nvim-treesitter-textobjects",
"RRethy/nvim-treesitter-endwise",
},
init = function()
vim.api.nvim_create_autocmd("BufEnter", {
group = vim.api.nvim_create_augroup("NeoTreeInit", { clear = true }),
callback = function()
local f = vim.fn.expand("%:p")
if vim.fn.isdirectory(f) == 0 then
require("neo-tree")
-- neo-tree is loaded now, delete the init autocmd
return true
end
end,
})
end,
config = function()
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.typst = {