Add autosizing whenever we open/close an edge panel, meaning we always

keep the relative width/height of the main windows
This commit is contained in:
Martin Larsson 2024-07-05 16:50:17 +02:00
parent 7c45912194
commit 7316bef23d
3 changed files with 65 additions and 12 deletions

View file

@ -4,6 +4,8 @@ local oil = nil
local oil_window = nil
local function toggle_oil_window()
assert(oil, "Oil is not loaded")
if oil_window and vim.api.nvim_win_is_valid(oil_window) then
vim.api.nvim_win_close(oil_window, true)
oil_window = nil
@ -46,10 +48,14 @@ return {
},
})
require("utils").add_keymaps({
local wm = require("window_management")
utils.add_keymaps({
n = {
["<leader>o"] = {
cmd = toggle_oil_window,
cmd = function()
toggle_oil_window()
wm.autosize_windows()
end,
}
}
})