Revert "Adds config for smart split navigation"

This reverts commit 158700874c.
This commit is contained in:
Dennis 2025-05-15 15:36:25 +02:00
parent 6318f37c21
commit d75dbe0c62
6 changed files with 20 additions and 57 deletions

View file

@ -44,36 +44,11 @@ function M.get_padding(padding, remove_padding_bottom)
}
end
function M.is_vim(pane)
-- this is set by the plugin, and unset on ExitPre in Neovim
return pane:get_user_vars().IS_NVIM == "true"
end
local direction_keys = {
h = "Left",
j = "Down",
k = "Up",
l = "Right",
}
function M.split_nav(resize_or_move, key)
function M.move_pane(key, direction)
return {
key = key,
mods = resize_or_move == "resize" and "META" or "CTRL",
action = wezterm.action_callback(function(win, pane)
if M.is_vim(pane) then
-- pass the keys through to vim/nvim
win:perform_action({
SendKey = { key = key, mods = resize_or_move == "resize" and "META" or "CTRL" },
}, pane)
else
if resize_or_move == "resize" then
win:perform_action({ AdjustPaneSize = { direction_keys[key], 3 } }, pane)
else
win:perform_action({ ActivatePaneDirection = direction_keys[key] }, pane)
end
end
end),
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection(direction),
}
end

View file

@ -42,14 +42,10 @@ function M.apply_to_config(config)
}),
},
-- Navigation
helpers.split_nav("move", "h"),
helpers.split_nav("move", "j"),
helpers.split_nav("move", "k"),
helpers.split_nav("move", "l"),
helpers.split_nav("resize", "h"),
helpers.split_nav("resize", "j"),
helpers.split_nav("resize", "k"),
helpers.split_nav("resize", "l"),
helpers.move_pane("j", "Down"),
helpers.move_pane("k", "Up"),
helpers.move_pane("h", "Left"),
helpers.move_pane("l", "Right"),
-- Workspaces
{
key = "s",