Add :ResizeFixed command
This commit is contained in:
@@ -205,3 +205,19 @@ end, { range = true })
|
|||||||
vim.api.nvim_create_user_command('DiagnosticToggle', function(_)
|
vim.api.nvim_create_user_command('DiagnosticToggle', function(_)
|
||||||
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
|
vim.diagnostic.enable(not vim.diagnostic.is_enabled())
|
||||||
end, {})
|
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 = '?' })
|
||||||
|
|||||||
Reference in New Issue
Block a user