@@ -110,7 +110,7 @@ function! VimuxOpenRunner() abort
110110 elseif VimuxOption (' VimuxRunnerType' ) == # ' window'
111111 call VimuxTmux (' new-window ' .extraArguments)
112112 endif
113- let g: VimuxRunnerIndex = s: tmuxIndex ( )
113+ let g: VimuxRunnerIndex = s: tmuxProperty ( ' #{pane_id} ' )
114114 call s: setRunnerName ()
115115 call VimuxTmux (' last-' .VimuxOption (' VimuxRunnerType' ))
116116 endif
@@ -128,15 +128,9 @@ function! VimuxTogglePane() abort
128128 if VimuxOption (' VimuxRunnerType' ) == # ' window'
129129 call VimuxTmux (' join-pane -s ' .g: VimuxRunnerIndex .' ' .s: vimuxPaneOptions ())
130130 let g: VimuxRunnerType = ' pane'
131- let g: VimuxRunnerIndex = s: tmuxIndex ()
132131 call VimuxTmux (' last-' .VimuxOption (' VimuxRunnerType' ))
133132 elseif VimuxOption (' VimuxRunnerType' ) == # ' pane'
134- let g: VimuxRunnerIndex= substitute (
135- \ VimuxTmux (' break-pane -d -s ' .g: VimuxRunnerIndex ." -P -F '#{window_id}'" ),
136- \ ' \n' ,
137- \ ' ' ,
138- \ ' '
139- \)
133+ call VimuxTmux (' break-pane -d -s ' .g: VimuxRunnerIndex )
140134 let g: VimuxRunnerType = ' window'
141135 endif
142136 else
@@ -245,35 +239,15 @@ function! s:exitCopyMode() abort
245239 endtry
246240endfunction
247241
248- function ! s: tmuxSession () abort
249- return s: tmuxProperty (' #S' )
250- endfunction
251-
252- function ! s: tmuxIndex () abort
253- if VimuxOption (' VimuxRunnerType' ) == # ' pane'
254- return s: tmuxPaneId ()
255- else
256- return s: tmuxWindowId ()
257- end
258- endfunction
259-
260- function ! s: tmuxPaneId () abort
261- return s: tmuxProperty (' #{pane_id}' )
262- endfunction
263-
264- function ! s: tmuxWindowId () abort
265- return s: tmuxProperty (' #{window_id}' )
266- endfunction
267-
268242function ! s: vimuxPaneOptions () abort
269243 let height = VimuxOption (' VimuxHeight' )
270244 let orientation = VimuxOption (' VimuxOrientation' )
271245 return ' -l ' .height.' -' .orientation
272246endfunction
273247
274248" "
275- " @return a string of the form '%4', the ID of the pane or window to use,
276- " or '' if no nearest pane or window is found.
249+ " @return a string of the form '%4', the ID of the pane to use,
250+ " or '' if no nearest pane is found.
277251function ! s: existingRunnerId () abort
278252 let runnerType = VimuxOption (' VimuxRunnerType' )
279253 let query = get (VimuxOption (' VimuxRunnerQuery' ), runnerType, ' ' )
@@ -285,12 +259,11 @@ function! s:existingRunnerId() abort
285259 endif
286260 endif
287261 " Try finding the runner using the provided query
288- let currentId = s: tmuxIndex ( )
262+ let currentId = s: tmuxProperty ( ' #{pane_id} ' )
289263 let message = VimuxTmux (' select-' .runnerType.' -t ' .query.' ' )
290264 if message == # ' '
291- " A match was found. Make sure it isn't the current vim pane/window
292- " though!
293- let runnerId = s: tmuxIndex ()
265+ " A match was found. Make sure it isn't the current vim pane!
266+ let runnerId = s: tmuxProperty (' #{pane_id}' )
294267 if runnerId !=# currentId
295268 " Success!
296269 call VimuxTmux (' last-' .runnerType)
@@ -355,8 +328,7 @@ function! s:hasRunner() abort
355328 if get (g: , ' VimuxRunnerIndex' , ' ' ) == ? ' '
356329 return v: false
357330 endif
358- let l: runnerType = VimuxOption (' VimuxRunnerType' )
359- let l: command = ' list-' .runnerType." s -a -F '#{" .runnerType." _id}'"
331+ let l: command = " list-panes -a -F '#{pane_id}'"
360332 let l: found = match (VimuxTmux (l: command ), g: VimuxRunnerIndex )
361333 return l: found != -1
362334endfunction
0 commit comments