From 67eaa0689c91a2043af44dbd63c771b134411ecc Mon Sep 17 00:00:00 2001 From: Chris Grieser <73286100+chrisgrieser@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:36:40 +0200 Subject: [PATCH] fix: prevent changing buffer in lazy window Adds the new `winfixbuf` to the window options of the lazy window. This makes the buffer "sticky", preventing accidentally switching to another buffer while in that window, e.g. via `:edit`. See the PR at nvim core https://github.com/neovim/neovim/issues/12517 `winfixbuf` is only available on newer nvim versions, so adding the option is wrapped in a condition checking whether it is supported. --- lua/lazy/view/float.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/lazy/view/float.lua b/lua/lazy/view/float.lua index 4131d72..255b9e3 100644 --- a/lua/lazy/view/float.lua +++ b/lua/lazy/view/float.lua @@ -184,6 +184,9 @@ function M:mount() Util.wo(self.win, "wrap", true) Util.wo(self.win, "winhighlight", "Normal:LazyNormal") Util.wo(self.win, "colorcolumn", "") + if vim.fn.exists('&winfixbuf') == 1 then + Util.wo(self.win, "winfixbuf", true) + end end opts()