feat(wezterm): enhance tab management and simplify pane controls
Replace dynamic pane management with explicit keybindings for better discoverability. Add dmenu-based tab renaming and direct tab navigation by index for improved workflow efficiency.
This commit is contained in:
parent
591346600f
commit
83f23c3fd1
1 changed files with 45 additions and 33 deletions
|
|
@ -96,7 +96,7 @@ config.keys = {
|
||||||
--
|
--
|
||||||
|
|
||||||
{ -- Spawn new tab
|
{ -- Spawn new tab
|
||||||
key = "t",
|
key = "Tab",
|
||||||
mods = "LEADER",
|
mods = "LEADER",
|
||||||
action = wezterm.action.SpawnTab("CurrentPaneDomain"),
|
action = wezterm.action.SpawnTab("CurrentPaneDomain"),
|
||||||
},
|
},
|
||||||
|
|
@ -113,58 +113,61 @@ config.keys = {
|
||||||
action = wezterm.action.ActivateTabRelative(1),
|
action = wezterm.action.ActivateTabRelative(1),
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Close tab
|
{ -- Quit/close tab
|
||||||
key = "Q",
|
key = "Q",
|
||||||
mods = "LEADER",
|
mods = "LEADER",
|
||||||
action = wezterm.action.CloseCurrentTab({ confirm = false }),
|
action = wezterm.action.CloseCurrentTab({ confirm = false }),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ -- Rename current tab
|
||||||
|
key = ",",
|
||||||
|
mods = "LEADER",
|
||||||
|
action = wezterm.action_callback(function(window, pane)
|
||||||
|
local success, stdout, stderr = wezterm.run_child_process({
|
||||||
|
"dmenu",
|
||||||
|
"-fn",
|
||||||
|
"Fisa Code-10",
|
||||||
|
"-p",
|
||||||
|
"Tab name:",
|
||||||
|
})
|
||||||
|
if success and stdout then
|
||||||
|
local name = stdout:gsub("\n", "")
|
||||||
|
if name ~= "" then
|
||||||
|
window:active_tab():set_title(name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
},
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Pane management
|
-- Pane management
|
||||||
--
|
--
|
||||||
|
|
||||||
{ -- Split pane vertically
|
{ -- Split pane vertically (bottom, 30%)
|
||||||
key = "s",
|
key = "s",
|
||||||
mods = "LEADER",
|
mods = "LEADER",
|
||||||
action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }),
|
action = wezterm.action.SplitPane({
|
||||||
|
direction = "Down",
|
||||||
|
size = { Percent = 30 },
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Split pane horizontally
|
{ -- Split pane horizontally (left, 28%)
|
||||||
key = "v",
|
key = "v",
|
||||||
mods = "LEADER",
|
mods = "LEADER",
|
||||||
action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
|
action = wezterm.action.SplitPane({
|
||||||
},
|
|
||||||
|
|
||||||
{ -- Dynamic pane management
|
|
||||||
key = "`",
|
|
||||||
mods = "LEADER",
|
|
||||||
action = wezterm.action_callback(function(_, pane)
|
|
||||||
local tab = pane:tab()
|
|
||||||
local panes = tab:panes_with_info()
|
|
||||||
|
|
||||||
if #panes == 1 then
|
|
||||||
pane:split({
|
|
||||||
direction = "Bottom",
|
|
||||||
size = 0.30,
|
|
||||||
})
|
|
||||||
pane:split({
|
|
||||||
direction = "Left",
|
direction = "Left",
|
||||||
size = 0.28,
|
size = { Percent = 28 },
|
||||||
args = { "claude" }
|
}),
|
||||||
})
|
|
||||||
|
|
||||||
elseif not panes[2].is_zoomed then
|
|
||||||
panes[2].pane:activate()
|
|
||||||
tab:set_zoomed(true)
|
|
||||||
|
|
||||||
elseif panes[2].is_zoomed then
|
|
||||||
tab:set_zoomed(false)
|
|
||||||
panes[3].pane:activate()
|
|
||||||
end
|
|
||||||
end),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Close pane
|
{ -- Toggle pane zoom
|
||||||
|
key = "t",
|
||||||
|
mods = "LEADER",
|
||||||
|
action = wezterm.action.TogglePaneZoomState,
|
||||||
|
},
|
||||||
|
|
||||||
|
{ -- Quit/close pane
|
||||||
key = "q",
|
key = "q",
|
||||||
mods = "LEADER",
|
mods = "LEADER",
|
||||||
action = wezterm.action.CloseCurrentPane({ confirm = false }),
|
action = wezterm.action.CloseCurrentPane({ confirm = false }),
|
||||||
|
|
@ -197,6 +200,15 @@ config.keys = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Jump to specific tabs by number (ALT + 1-9)
|
||||||
|
for i = 1, 9 do
|
||||||
|
table.insert(config.keys, {
|
||||||
|
key = tostring(i),
|
||||||
|
mods = "ALT",
|
||||||
|
action = wezterm.action.ActivateTab(i - 1),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Enable neovim integration
|
-- Enable neovim integration
|
||||||
--
|
--
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue