The below code is from the repository:
vim.api.nvim_create_autocmd("FileType", {
group = M.augroup,
callback = vim.schedule_wrap(function()
M.buf_attach()
end),
})
For this code, if there are some buffers whose filetype changed, this autocmd will try to attach to the current buffer even if the filetype is trigger by other buffers.
For example:
- I use
:Copilot dettach to detach from a large file.
- Then I do something that will let 'noice.nvim' give me a notification.
- The filetype autocmd is triggered due to the notification buffer's filetype is set to 'Noice'.
- And copilot will attach to current large buffer, which I do not want copilot to attach.
The solution is very simple, there should be added one more parameter for attach a specific buffer, and use ev.buf to specify the buffer instead of current buffer.
The below code is from the repository:
For this code, if there are some buffers whose filetype changed, this autocmd will try to attach to the current buffer even if the filetype is trigger by other buffers.
For example:
:Copilot dettachto detach from a large file.The solution is very simple, there should be added one more parameter for attach a specific buffer, and use
ev.bufto specify the buffer instead of current buffer.