diff --git a/home/sam/nvim/lua/sam/plugins/treesitter.lua b/home/sam/nvim/lua/sam/plugins/treesitter.lua index da46026..55b56fd 100755 --- a/home/sam/nvim/lua/sam/plugins/treesitter.lua +++ b/home/sam/nvim/lua/sam/plugins/treesitter.lua @@ -3,9 +3,21 @@ return { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate", -- Installs and updates parsers - config = function() - require("nvim-treesitter.configs").setup({ - -- A list of parser names, or "all" + +config = function() + local ok, ts = pcall(require, "nvim-treesitter.config") + if not ok then + ok, ts = pcall(require, "nvim-treesitter.configs") + end + if not ok then + vim.notify( + "nvim-treesitter: config module not found", + vim.log.levels.ERROR + ) + return + end + + ts.setup({ ensure_installed = { "c", "cpp", @@ -21,16 +33,10 @@ return { "json", "php", }, - - -- Install parsers synchronously (only applied on startup) sync_install = false, - - -- Automatically install missing parsers when entering buffer auto_install = true, - - highlight = { - enable = true, - }, + highlight = { enable = true }, }) end, + }