diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index 9d63691..4d865b1 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,13 +1,24 @@ return { - { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", - config = function () - local configs = require("nvim-treesitter.configs") - configs.setup({ - ensure_installed = { "lua", "vim", "yaml" }, - sync_install = false, - highlight = { enable = true }, - indent = { enable = true }, - }) - end - } -} + "nvim-treesitter/nvim-treesitter", + lazy = false, + build = ":TSUpdate", + config = function () + local treesitter = require("nvim-treesitter") + treesitter.setup() + treesitter.install { "lua", "vim", "yaml" } + + vim.api.nvim_create_autocmd('FileType', { + pattern = { "lua", "vim", "yaml" }, + callback = function() + -- syntax highlighting, provided by Neovim + vim.treesitter.start() + -- folds, provided by Neovim (I don't like folds) + -- 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 + }