fix: block autocommands when setting preview buffer (#2010)
Telescope creates most floating windows with `noautocmd = true`, so these windows do not trigger autocommands, but preview buffer is set in window using `nvim_win_set_buf()`, which triggers buffer autocommands. This may be unwanted, so block them using 'eventignore'.
This commit is contained in:
@@ -410,6 +410,13 @@ function utils.get_os_command_output(cmd, cwd)
|
||||
return stdout, ret, stderr
|
||||
end
|
||||
|
||||
function utils.win_set_buf_noautocmd(win, buf)
|
||||
local save_ei = vim.o.eventignore
|
||||
vim.o.eventignore = "all"
|
||||
vim.api.nvim_win_set_buf(win, buf)
|
||||
vim.o.eventignore = save_ei
|
||||
end
|
||||
|
||||
local load_once = function(f)
|
||||
local resolved = nil
|
||||
return function(...)
|
||||
|
||||
Reference in New Issue
Block a user