Detach the currently effective buffer number

This commit is contained in:
Karl Wang 2022-02-03 20:24:23 -08:00 committed by windwp
parent 32bc46ee8b
commit 5bbdfdaa30
2 changed files with 4 additions and 5 deletions

View File

@ -1,5 +1,4 @@
local internal= require('nvim-ts-autotag.internal')
local internal = require("nvim-ts-autotag.internal")
local M = {}
@ -19,7 +18,7 @@ function M.setup(opts)
vim.cmd[[augroup nvim_ts_xmltag]]
vim.cmd[[autocmd!]]
vim.cmd[[autocmd FileType * call v:lua.require('nvim-ts-autotag.internal').attach()]]
vim.cmd[[autocmd BufDelete * call v:lua.require('nvim-ts-autotag.internal').detach()]]
vim.cmd[[autocmd BufDelete * lua require('nvim-ts-autotag.internal').detach(vim.fn.expand('<abuf>'))]]
vim.cmd[[augroup end]]
end

View File

@ -426,8 +426,8 @@ M.attach = function (bufnr,lang)
end
end
M.detach = function ( )
local bufnr = vim.api.nvim_get_current_buf()
M.detach = function (bufnr)
bufnr = tonumber(bufnr) or vim.api.nvim_get_current_buf()
buffer_tag[bufnr] = nil
end