File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,10 @@ function Wezterm.new(opts)
3030 return self
3131end
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.
3438function Wezterm .health ()
3539 if vim .fn .executable (" wezterm" ) ~= 1 then
@@ -63,6 +67,8 @@ function Wezterm:get_pane_id()
6367 )
6468 if result and result ~= " " and not result :match (" error" ) then
6569 self .pane_id = result :match (" ^%d+" )
70+ else
71+ self .pane_id = nil
6672 end
6773
6874 return self .pane_id
@@ -104,6 +110,8 @@ function Wezterm:start()
104110
105111 -- Execute and capture the pane ID
106112 local result = vim .fn .system (table.concat (cmd_parts , " " ))
113+ focus_pane (vim .env .WEZTERM_PANE )
114+
107115 self .pane_id = result :match (" ^%d+" )
108116 end
109117end
@@ -125,7 +133,7 @@ function Wezterm:show()
125133 return
126134 end
127135
128- vim . fn . system ( string.format ( " wezterm cli activate-pane --pane-id %d " , pane_id ) )
136+ focus_pane ( pane_id )
129137end
130138
131139return Wezterm
You can’t perform that action at this time.
0 commit comments