fix(lsp): set 'winfixbuf' in open_floating_preview() window #39058

Problem:
The window opened by `vim.lsp.util.open_floating_preview()`
allows its buffer to be switched. Presumably that only happens
by accident and is disorienting.

Solution:
Set 'winfixbuf' in the open_floating_preview() window.
This commit is contained in:
Raizento
2026-04-15 23:14:35 +02:00
committed by GitHub
parent 646ce85aa5
commit d2fff0590a
2 changed files with 5 additions and 2 deletions

View File

@@ -1779,6 +1779,7 @@ function M.open_floating_preview(contents, syntax, opts)
vim.wo[floating_winnr].linebreak = true -- Break lines a bit nicer
vim.wo[floating_winnr].breakindent = true -- Slightly better list presentation.
vim.wo[floating_winnr].smoothscroll = true -- Scroll by screen-line instead of buffer-line.
vim.wo[floating_winnr].winfixbuf = true -- Disable buffer switching.
vim.bo[floating_bufnr].modifiable = false
vim.bo[floating_bufnr].bufhidden = 'wipe'