enhance wezterm: add intelligent development layout with Claude integration

- Create 3-pane layout automatically: editor (main), terminal (bottom 30%), Claude sidebar (left 25%)
- Implement smart focus management between editor and terminal panes
- Add zoom toggling for distraction-free editing sessions
- Launch Claude Code automatically in dedicated sidebar pane
This commit is contained in:
♥ Minnie ♥ 2025-09-29 12:44:39 +08:00
parent abbf55046f
commit 1029f738b8
Signed by: jasmine
GPG key ID: 8563E358D4E8040E

View file

@ -135,23 +135,36 @@ config.keys = {
action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
},
{ -- If there is only one pane, split it vertically, otherwise toggle zoom on the first pane.
{ -- Dynamic pane management: Creates development layout or toggles focus between editor and terminal
key = "`",
mods = "LEADER",
action = wezterm.action_callback(function(_, pane)
local tab = pane:tab()
local panes = tab:panes_with_info()
-- Case 1: Single pane - Create a 3-pane development layout
if #panes == 1 then
-- First split: Create bottom terminal pane (30% height)
pane:split({
direction = "Bottom",
size = 0.3,
size = 0.30,
})
elseif not panes[1].is_zoomed then
panes[1].pane:activate()
tab:set_zoomed(true)
elseif panes[1].is_zoomed then
tab:set_zoomed(false)
panes[2].pane:activate()
-- Second split: Create left sidebar for Claude Code (25% width)
pane:split({
direction = "Left",
size = 0.25,
args = { "claude" } -- Launch Claude Code in the sidebar
})
-- Case 2: Multiple panes exist, pane 2 (editor) is not zoomed - Focus and zoom editor
elseif not panes[2].is_zoomed then
panes[2].pane:activate() -- Switch to editor pane (typically Neovim)
tab:set_zoomed(true) -- Zoom to hide other panes for focused editing
-- Case 3: Pane 2 (editor) is currently zoomed - Unzoom and return to terminal
elseif panes[2].is_zoomed then
tab:set_zoomed(false) -- Restore multi-pane layout
panes[3].pane:activate() -- Focus the terminal pane for quick commands
end
end),
},