Add :ResizeFixed command

This commit is contained in:
2026-07-13 13:44:54 +01:00
parent e563f99b0f
commit 7a9d8ddbf8

View File

@@ -205,3 +205,19 @@ end, { range = true })
vim.api.nvim_create_user_command('DiagnosticToggle', function(_)
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
end, {})
-- :ResizeFixed acts like :resize but also fixes the window size so it stops
-- automatically changing when other windows reflow. Respects the :vertical
-- modifier, resizing and fixing the width instead of the height.
vim.api.nvim_create_user_command('ResizeFixed', function(opts)
local cmd = { cmd = 'resize', mods = opts.smods }
if opts.args ~= '' then
cmd.args = { opts.args }
end
vim.cmd(cmd)
if opts.smods.vertical then
vim.wo.winfixwidth = true
else
vim.wo.winfixheight = true
end
end, { nargs = '?' })