Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions plugin/vimux.vim
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function! VimuxOpenRunner() abort
return
endif
let existingId = s:existingRunnerId()
if existingId !=# ''
if !exists('g:VimuxRunnerIndex') && existingId !=# ''
let g:VimuxRunnerIndex = existingId
else
let extraArguments = VimuxOption('VimuxOpenExtraArgs')
Expand Down Expand Up @@ -355,10 +355,8 @@ function! s:hasRunner() abort
if get(g:, 'VimuxRunnerIndex', '') ==? ''
return v:false
endif
let l:runnerType = VimuxOption('VimuxRunnerType')
let l:command = 'list-'.runnerType."s -F '#{".runnerType."_id}'"
let l:found = match(VimuxTmux(l:command), g:VimuxRunnerIndex)
return l:found != -1
let runnerType = VimuxOption('VimuxRunnerType')
return match(VimuxTmux('list-'.runnerType."s -a -F '#{".runnerType."_id}'"), g:VimuxRunnerIndex)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need this returning a comparison against -1, as it was before, since match() returns the byte location where the match was found, or -1 if no match was found, and -1 is truthy in vim.

I like to avoid doing too much in one line, even if it means more lines of code and more variables- unless a good performance case can be made. Can you please keep the separate lines for defining the command and capturing the match result?

endfunction

function! s:autoclose() abort
Expand Down