Skip to content

Commit b1c28c5

Browse files
author
John Mutuma (from Dev Box)
committed
fix(tmux): run set-option as separate commands on Windows for psmux compatibility
1 parent c2bdf8c commit b1c28c5

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

lua/sidekick/cli/session/tmux.lua

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,20 @@ function M:start()
3333
local cmd = { "tmux", "new", "-A", "-s", self.id }
3434
vim.list_extend(cmd, { "-c", self.cwd })
3535
self:add_cmd(cmd)
36-
vim.list_extend(cmd, { ";", "set-option", "status", "off" })
37-
vim.list_extend(cmd, { ";", "set-option", "detach-on-destroy", "on" })
36+
if vim.fn.has("win32") == 1 then
37+
-- On Windows (psmux), ";" command chaining is not supported.
38+
-- PowerShell interprets ";" as a statement separator, causing
39+
-- "set-option" to be run as a standalone cmdlet (which fails).
40+
-- Instead, run set-option as separate commands after the session starts.
41+
local id = self.id
42+
vim.defer_fn(function()
43+
vim.fn.system({ "tmux", "set-option", "-t", id, "status", "off" })
44+
vim.fn.system({ "tmux", "set-option", "-t", id, "detach-on-destroy", "on" })
45+
end, 1000)
46+
else
47+
vim.list_extend(cmd, { ";", "set-option", "status", "off" })
48+
vim.list_extend(cmd, { ";", "set-option", "detach-on-destroy", "on" })
49+
end
3850
return { cmd = cmd }
3951
elseif Config.cli.mux.create == "window" then
4052
local cmd = { "tmux", "new-window", "-dP", "-c", self.cwd, "-F", PANE_FORMAT }

0 commit comments

Comments
 (0)