diff --git a/lua/wiremux/backend/tmux/action.lua b/lua/wiremux/backend/tmux/action.lua index 92e0276..4b6e08a 100644 --- a/lua/wiremux/backend/tmux/action.lua +++ b/lua/wiremux/backend/tmux/action.lua @@ -103,4 +103,16 @@ function M.resize_pane_zoom(pane_id) return cmd end +---@param direction "horizontal"|"vertical" +---@param size string +---@param pane_id? string +---@return string[] +function M.resize_pane(direction, size, pane_id) + local cmd = { "resize-pane", direction == "horizontal" and "-x" or "-y", size } + if pane_id then + vim.list_extend(cmd, { "-t", pane_id }) + end + return cmd +end + return M diff --git a/lua/wiremux/backend/tmux/operation.lua b/lua/wiremux/backend/tmux/operation.lua index 7b8a6e8..e187343 100644 --- a/lua/wiremux/backend/tmux/operation.lua +++ b/lua/wiremux/backend/tmux/operation.lua @@ -151,10 +151,15 @@ function M.create(target_name, def, st) table.insert(cmds, action.new_window(window_name, not use_shell and cmd or nil)) table.insert(cmds, query.window_id()) else + local split = def.split or "horizontal" table.insert( cmds, - action.split_pane(def.split or "horizontal", st.origin_pane_id, not use_shell and cmd or nil) + action.split_pane(split, st.origin_pane_id, not use_shell and cmd or nil) ) + local size = def.size + if size then + table.insert(cmds, action.resize_pane(split, def.size)) + end table.insert(cmds, query.pane_id()) end diff --git a/lua/wiremux/config.lua b/lua/wiremux/config.lua index 2dfebd8..0800e35 100644 --- a/lua/wiremux/config.lua +++ b/lua/wiremux/config.lua @@ -45,6 +45,7 @@ local M = {} ---@field shell? boolean Run command through shell (default: true) ---@field label? string|fun(inst: wiremux.Instance, index: number): string Custom display label for picker ---@field title? string Custom tmux window / zellij tab name +---@field size? string Custom tmux pane size ---@field startup_timeout? number Max milliseconds to wait for TUI to render before sending (default: 3500) local defaults = {