Skip to content

Commit e36c4cd

Browse files
committed
fix: respect value of g:VimuxRunnerIndex and look for valid pane runner
1 parent 04f299e commit e36c4cd

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

plugin/vimux.vim

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function! VimuxOpenRunner() abort
101101
return
102102
endif
103103
let existingId = s:existingRunnerId()
104-
if existingId !=# ''
104+
if !exists('g:VimuxRunnerIndex') && existingId !=# ''
105105
let g:VimuxRunnerIndex = existingId
106106
else
107107
let extraArguments = VimuxOption('VimuxOpenExtraArgs')
@@ -351,14 +351,13 @@ function! s:tmuxProperty(property) abort
351351
return substitute(VimuxTmux("display -p '".a:property."'"), '\n$', '', '')
352352
endfunction
353353

354-
function! s:hasRunner() abort
354+
function! s:hasRunner(index) abort
355355
if get(g:, 'VimuxRunnerIndex', '') ==? ''
356356
return v:false
357357
endif
358-
let l:runnerType = VimuxOption('VimuxRunnerType')
359-
let l:command = 'list-'.runnerType."s -F '#{".runnerType."_id}'"
360-
let l:found = match(VimuxTmux(l:command), g:VimuxRunnerIndex)
361-
return l:found != -1
358+
let runnerType = VimuxOption('VimuxRunnerType')
359+
let allPanes = runnerType ==# 'pane' ? '-a ' : ''
360+
return match(VimuxTmux('list-'.runnerType."s ".allPanes."-F '#{".runnerType."_id}'"), a:index)
362361
endfunction
363362

364363
function! s:autoclose() abort

0 commit comments

Comments
 (0)