diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-06-15 16:43:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-15 10:43:10 +0200 |
| commit | d96eaa914aab6cfc4adccb34af421bdd496468b0 (patch) | |
| tree | a220578061de2adfb395ca2315c2907105e3b3d9 /lua/telescope/utils.lua | |
| parent | f33df8f35f2ee0cf9bb19142a4a41b3dc6c0d0b6 (diff) | |
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'.
Diffstat (limited to 'lua/telescope/utils.lua')
| -rw-r--r-- | lua/telescope/utils.lua | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua index 133a120..2a8de58 100644 --- a/lua/telescope/utils.lua +++ b/lua/telescope/utils.lua @@ -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(...) |
