From 56c07f0ff511d024e4ffea417fef480fa0b5b657 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Thu, 10 Sep 2026 22:19:24 +0200 Subject: Add treesitter + auto-pairs/auto-tag-closing to Neovim config Not part of the original vimrc (no auto-pairs plugin existed there) - added per request for PyCharm-like brace/quote/HTML-tag auto-closing. - nvim-treesitter (main branch, the current rewrite) with parsers for the languages already covered by the LSP/plugin setup, plus highlighting enabled generically via vim.treesitter.start() on FileType (a no-op, caught by pcall, for filetypes without a parser). - nvim-autopairs for bracket/quote auto-closing. - nvim-ts-autotag (treesitter-based) for HTML/JSX/similar tag auto-closing and renaming. --- neovim/.config/nvim/lua/plugins/autopairs.lua | 23 +++++++++++++++++ neovim/.config/nvim/lua/plugins/treesitter.lua | 35 ++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 neovim/.config/nvim/lua/plugins/autopairs.lua create mode 100644 neovim/.config/nvim/lua/plugins/treesitter.lua (limited to 'neovim/.config/nvim/lua/plugins') diff --git a/neovim/.config/nvim/lua/plugins/autopairs.lua b/neovim/.config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..877e570 --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,23 @@ +return { + { + "windwp/nvim-autopairs", + event = "InsertEnter", + opts = {}, + }, + { + "windwp/nvim-ts-autotag", + ft = { + "html", + "xml", + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "svelte", + "php", + }, + dependencies = { "nvim-treesitter/nvim-treesitter" }, + opts = {}, + }, +} diff --git a/neovim/.config/nvim/lua/plugins/treesitter.lua b/neovim/.config/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..875500f --- /dev/null +++ b/neovim/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,35 @@ +return { + "nvim-treesitter/nvim-treesitter", + branch = "main", + build = ":TSUpdate", + config = function() + require("nvim-treesitter").install({ + "lua", + "vim", + "vimdoc", + "query", + "python", + "bash", + "yaml", + "hcl", + "terraform", + "html", + "css", + "javascript", + "typescript", + "tsx", + "json", + "markdown", + "markdown_inline", + }) + + -- Enable highlighting for any buffer whose filetype has an installed + -- parser; vim.treesitter.start() is a no-op (caught by pcall) otherwise. + vim.api.nvim_create_autocmd("FileType", { + pattern = "*", + callback = function() + pcall(vim.treesitter.start) + end, + }) + end, +} -- cgit v1.3