diff --git a/neovim/.config/nvim/after/plugin/treesitter.lua b/neovim/.config/nvim/after/plugin/treesitter.lua index 98d3b05..10cd6a4 100644 --- a/neovim/.config/nvim/after/plugin/treesitter.lua +++ b/neovim/.config/nvim/after/plugin/treesitter.lua @@ -1,35 +1,48 @@ -require("nvim-treesitter.configs").setup({ - ensure_installed = { - "bash", - "c", - "cmake", - "comment", - "css", - "dockerfile", - "go", - "gomod", - "html", - "javascript", - "jsdoc", - "json", - "jsonc", - "lua", - "make", - "markdown", - "python", - "rust", - "scss", - "svelte", - "tsx", - "typescript", - "vim", - "yaml", - }, - highlight = { - enable = true, - }, +local languages = { + "bash", + "c", + "cmake", + "comment", + "css", + "dockerfile", + "go", + "gomod", + "html", + "javascript", + "jsdoc", + "json", + "lua", + "make", + "markdown", + "python", + "rust", + "scss", + "svelte", + "tsx", + "typescript", + "vim", + "yaml", +} + +require("nvim-treesitter").setup({ + install_dir = vim.fn.stdpath("data") .. "/site", }) +vim.api.nvim_create_autocmd("FileType", { + pattern = { "*" }, + callback = function() + pcall(vim.treesitter.start) + end, +}) + +vim.api.nvim_create_user_command("NvimTSInstall", function() + require("nvim-treesitter").install(languages) +end, {}) + +vim.api.nvim_create_user_command("NvimTSUpdate", function() + require("nvim-treesitter").update(languages) +end, {}) + require("nvim-ts-autotag").setup({ opts = { enable_close = true, diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua index 4fe361c..46f45d2 100644 --- a/neovim/.config/nvim/init.lua +++ b/neovim/.config/nvim/init.lua @@ -16,7 +16,7 @@ pack.add("nvim-telescope/telescope.nvim") pack.add({ src = "nvim-treesitter/nvim-treesitter", - version = "master", + version = "main", }) pack.add("windwp/nvim-ts-autotag") pack.add("windwp/nvim-autopairs") diff --git a/neovim/.config/nvim/nvim-pack-lock.json b/neovim/.config/nvim/nvim-pack-lock.json index 82129a2..a6fae95 100644 --- a/neovim/.config/nvim/nvim-pack-lock.json +++ b/neovim/.config/nvim/nvim-pack-lock.json @@ -73,9 +73,9 @@ "src": "https://github.com/nvim-tree/nvim-tree.lua" }, "nvim-treesitter": { - "rev": "42fc28ba918343ebfd5565147a42a26580579482", + "rev": "7caec274fd19c12b55902a5b795100d21531391f", "src": "https://github.com/nvim-treesitter/nvim-treesitter", - "version": "'master'" + "version": "'main'" }, "nvim-ts-autotag": { "rev": "8e1c0a389f20bf7f5b0dd0e00306c1247bda2595",