Skip to content

Commit a2f9442

Browse files
committed
fix(provider): add focus back to the neovim pane after a new opencode pane is spawned
1 parent 53a9c69 commit a2f9442

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/opencode/provider/wezterm.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ function Wezterm.new(opts)
3030
return self
3131
end
3232

33+
local function focus_pane(pane_id)
34+
vim.fn.system(string.format("wezterm cli activate-pane --pane-id %d", pane_id))
35+
end
36+
3337
---Check if `wezterm` is running in current terminal.
3438
function Wezterm.health()
3539
if vim.fn.executable("wezterm") ~= 1 then
@@ -104,6 +108,8 @@ function Wezterm:start()
104108

105109
-- Execute and capture the pane ID
106110
local result = vim.fn.system(table.concat(cmd_parts, " "))
111+
focus_pane(vim.env.WEZTERM_PANE)
112+
107113
self.pane_id = result:match("^%d+")
108114
end
109115
end
@@ -125,7 +131,7 @@ function Wezterm:show()
125131
return
126132
end
127133

128-
vim.fn.system(string.format("wezterm cli activate-pane --pane-id %d", pane_id))
134+
focus_pane(pane_id)
129135
end
130136

131137
return Wezterm

0 commit comments

Comments
 (0)