Skip to content

Commit

Permalink
fix: prevent changing buffer in lazy window
Browse files Browse the repository at this point in the history
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 neovim/neovim#12517

`winfixbuf` is only available on newer nvim versions, so adding the option is wrapped in a condition checking whether it is supported.
  • Loading branch information
chrisgrieser authored Sep 19, 2024
1 parent 460e1cd commit 67eaa06
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/lazy/view/float.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 67eaa06

Please sign in to comment.