-
-
Notifications
You must be signed in to change notification settings - Fork 46
Troubleshooting
Martin Kunz edited this page Apr 27, 2022
·
1 revision
Issue: cmdheight
after restore is incorrect
description: On restore the cmdheight
(location where ex commands can be written) spans almost the full window.
cause: Floating windows are not saved correctly in sessions. This means that when a floating window is present when the session is saved the parameters of the window are saved into the session but it does not include the window being floating.
fix: You can register a callback function for removing all the floating windows on save of a session. auto-session
allows to do this by the conf
key pre_save_cmds
.
function _G.close_all_floating_wins()
for _, win in ipairs(vim.api.nvim_list_wins()) do
local config = vim.api.nvim_win_get_config(win)
if config.relative ~= '' then
vim.api.nvim_win_close(win, false)
end
end
end
-- ...
require('auto-session').setup {
-- ...
pre_save_cmds = { _G.close_all_floating_wins },
-- ...
}
(credits: @rockyzhang24)