Add hjlk bindings for resizing windows in Window Manager, also fix incorrectly early out conditions
This commit is contained in:
parent
f72e3961ad
commit
80961aa2a3
1 changed files with 10 additions and 6 deletions
|
|
@ -140,21 +140,21 @@ local function resize_window(window, dir_char)
|
||||||
|
|
||||||
local function can_resize_window(win)
|
local function can_resize_window(win)
|
||||||
if not win then
|
if not win then
|
||||||
return true
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if get_total_num_windows_open() > 1 then
|
if get_total_num_windows_open() <= 1 then
|
||||||
return true
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if is_floating_window(win) then
|
if is_floating_window(win) then
|
||||||
return true
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if can_resize_window(window) then
|
if not can_resize_window(window) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -255,6 +255,10 @@ end
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
local resizing_mode_keymaps = {
|
local resizing_mode_keymaps = {
|
||||||
|
{ "h", function() resize_window(vim.api.nvim_get_current_win(), "h") end },
|
||||||
|
{ "j", function() resize_window(vim.api.nvim_get_current_win(), "j") end },
|
||||||
|
{ "k", function() resize_window(vim.api.nvim_get_current_win(), "k") end },
|
||||||
|
{ "l", function() resize_window(vim.api.nvim_get_current_win(), "l") end },
|
||||||
{ "<Left>", function() resize_window(vim.api.nvim_get_current_win(), "h") end },
|
{ "<Left>", function() resize_window(vim.api.nvim_get_current_win(), "h") end },
|
||||||
{ "<Down>", function() resize_window(vim.api.nvim_get_current_win(), "j") end },
|
{ "<Down>", function() resize_window(vim.api.nvim_get_current_win(), "j") end },
|
||||||
{ "<Up>", function() resize_window(vim.api.nvim_get_current_win(), "k") end },
|
{ "<Up>", function() resize_window(vim.api.nvim_get_current_win(), "k") end },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue