Only delete autocmds for the current buffer with the group name

This commit is contained in:
Francis Belanger 2024-04-22 09:19:57 -04:00
parent f45cec078c
commit a37febf80b
1 changed files with 5 additions and 2 deletions

View File

@ -542,9 +542,12 @@ require('lazy').setup({
vim.api.nvim_create_autocmd('LspDetach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
callback = function()
callback = function(event)
vim.lsp.buf.clear_references()
vim.api.nvim_del_augroup_by_name 'kickstart-lsp-highlight'
local cmds = vim.api.nvim_get_autocmds { group = 'kickstart-lsp-highlight', buffer = event.buf }
for _, cmd in ipairs(cmds) do
vim.api.nvim_del_autocmd(cmd.id)
end
end,
})