From 30aea007e05253a602227eaa5d37fa5953304ac5 Mon Sep 17 00:00:00 2001 From: mbromell Date: Wed, 19 Jun 2024 21:00:25 +0100 Subject: [PATCH 1/2] Stop error message when using 'main' branch treesitter --- lua/nvim-ts-autotag.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/nvim-ts-autotag.lua b/lua/nvim-ts-autotag.lua index 118388c..8e334e1 100644 --- a/lua/nvim-ts-autotag.lua +++ b/lua/nvim-ts-autotag.lua @@ -9,6 +9,9 @@ function M.init() if not nvim_ts then return end + if nvim_ts.define_modules == nil then + return + end nvim_ts.define_modules({ autotag = { attach = function(bufnr, _) From 323a3e16ed603e2e17b26b1c836d1e86c279f726 Mon Sep 17 00:00:00 2001 From: windwp Date: Sun, 7 Jul 2024 15:07:44 +0700 Subject: [PATCH 2/2] fix: map Insertleave by buffer. --- lua/nvim-ts-autotag/internal.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lua/nvim-ts-autotag/internal.lua b/lua/nvim-ts-autotag/internal.lua index 61d0397..2459624 100644 --- a/lua/nvim-ts-autotag/internal.lua +++ b/lua/nvim-ts-autotag/internal.lua @@ -455,7 +455,7 @@ M.attach = function(bufnr) if TagConfigs:get(vim.bo.filetype) ~= nil then setup_ts_tag() - local group = vim.api.nvim_create_augroup("nvim-ts-autotag", { clear = true }) + local group = vim.api.nvim_create_augroup("nvim-ts-autotag-" .. bufnr, { clear = true }) if Setup.get_opts(vim.bo.filetype).enable_close then vim.keymap.set("i", ">", function() local row, col = unpack(vim.api.nvim_win_get_cursor(0)) @@ -485,12 +485,9 @@ M.attach = function(bufnr) }) end if Setup.get_opts(vim.bo.filetype).enable_rename then - -- HACK: This does not bind to a specific buffer, unfortunately it seems doing so will - -- break rename when switching between different buffers. Making it *not* bind to a - -- specific buffer shouldn't cause any problems in theory. Ideally it would be bound per - -- buffer, but for now this works (and I'm lazy). vim.api.nvim_create_autocmd("InsertLeave", { group = group, + buffer = bufnr, callback = M.rename_tag, }) end