Bug: The plugin cannot work well with ctrl-o
When using ctrl-o to go to an older cursor position, the current window might change to other buffer if the current buffer doesn't have enough items in the jump list. And if the current buffer is locked by stickybuf.nvim, it will vertically split the window.
Press ctrl-o several times:(the help buffer has been locked by stickybuf.nvim).
https://github.com/stevearc/stickybuf.nvim/assets/96286337/074407cf-f749-4d0c-9733-d0c921685856
Interesting, the default pinning for help buffers should allow them to be replaced by other help buffers. When I try to repro this (by doing :help then :help autocmd), the jumping works fine until I go back to a non-help file. Can you produce a minimal repro config that exhibits this behavior?
@stevearc I mean that if I go back to a non-help file, it will vertically split the window.
There is no way for stickybuf to tell the difference between switching buffers via :edit, or a file picker, or <C-o>. If this bothers you, you could set the handle_foreign_buffer function to no-op or display a warning instead of opening the new buffer in a vertical split. Example:
require("stickybuf").setup({
get_auto_pin = function(bufnr)
local pin_type = require("stickybuf").should_auto_pin(bufnr)
if pin_type then
return {
allow_type = pin_type,
handle_foreign_buffer = function()
vim.notify("Cannot open buffer in pinned window", vim.log.levels.WARN)
end,
}
end
end,
})