When toggling (closing) plugin with whatever keybinding set - in my case <leader>k - will also close my active buffer in the background.
Steps
open something with nvim
navigate to some file
toggle plugin on
toggle plugin off
Expectation
When executing step 4, the buffer that i've opened in step 2 shouldn't close alongside plugin
Potential fix
Rework the toggling functionality so that it only closes the plugin and not anything else.
Example that i've gotten from gitpad.nvim that does it correcly
function M.close_window(opts)
local wininfo = vim.fn.getwininfo(gitpad_win_id)
-- We might have closed the window not via this method so we need to
-- check if the window id is still valid via `getwininfo`
if gitpad_win_id == nil or vim.tbl_isempty(wininfo) then
gitpad_win_id = nil
return false
end
local bufnr = vim.api.nvim_win_get_buf(gitpad_win_id)
local bufname = vim.api.nvim_buf_get_name(bufnr)
-- Just ensure that we are closing the correct window
-- This is just to prevent closing a gitpad project window or gitpad branch window
if bufname == opts.path then
vim.api.nvim_win_close(gitpad_win_id, true)
gitpad_win_id = nil
return true
end
return false
end
Nice catch!
The problem was us setting the bufhidden property was doing something weird with the current window.
Fixed that and I don't seem to have caused any other problems 😅
When toggling (closing) plugin with whatever keybinding set - in my case
<leader>k
- will also close my active buffer in the background.Steps
Expectation When executing step 4, the buffer that i've opened in step 2 shouldn't close alongside plugin
Potential fix Rework the toggling functionality so that it only closes the plugin and not anything else.
Example that i've gotten from gitpad.nvim that does it correcly