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
19 changes: 13 additions & 6 deletions plugin/vimux.vim
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ function! VimuxTogglePane() abort
call VimuxTmux('join-pane -s '.g:VimuxRunnerIndex.' '.s:vimuxPaneOptions())
let g:VimuxRunnerType = 'pane'
let g:VimuxRunnerIndex = s:tmuxIndex()
call VimuxTmux('last-'.VimuxOption('VimuxRunnerType'))
call VimuxTmux('last-pane')
elseif VimuxOption('VimuxRunnerType') ==# 'pane'
let g:VimuxRunnerIndex=substitute(
\ VimuxTmux('break-pane -d -s '.g:VimuxRunnerIndex." -P -F '#{window_id}'"),
Expand All @@ -146,10 +146,10 @@ endfunction

function! VimuxZoomRunner() abort
if s:hasRunner()
call VimuxTmux('switch-client -t '.g:VimuxRunnerIndex)
call VimuxTmux('select-window -t '.g:VimuxRunnerIndex)
if VimuxOption('VimuxRunnerType') ==# 'pane'
call VimuxTmux('resize-pane -Z -t '.g:VimuxRunnerIndex)
elseif VimuxOption('VimuxRunnerType') ==# 'window'
call VimuxTmux('select-window -t '.g:VimuxRunnerIndex)
endif
else
call s:echoNoRunner()
Expand All @@ -158,8 +158,10 @@ endfunction

function! VimuxInspectRunner() abort
if s:hasRunner()
call VimuxTmux('select-'.VimuxOption('VimuxRunnerType').' -t '.g:VimuxRunnerIndex)
call VimuxTmux('copy-mode')
call VimuxTmux('switch-client -t '.g:VimuxRunnerIndex)
call VimuxTmux('select-window -t '.g:VimuxRunnerIndex)
call VimuxTmux('select-pane -t '.g:VimuxRunnerIndex)
call VimuxTmux('copy-mode -t '.g:VimuxRunnerIndex)
return v:true
endif
call s:echoNoRunner()
Expand Down Expand Up @@ -351,12 +353,17 @@ function! s:tmuxProperty(property) abort
return substitute(VimuxTmux("display -p '".a:property."'"), '\n$', '', '')
endfunction

function! VimuxHasRunner() abort
return s:hasRunner()
endfunction

function! s:hasRunner() abort
if get(g:, 'VimuxRunnerIndex', '') ==? ''
return v:false
endif
let runnerType = VimuxOption('VimuxRunnerType')
let l:found = match(VimuxTmux('list-'.runnerType."s -a -F '#{".runnerType."_id}'"), g:VimuxRunnerIndex)
let l:command = 'list-'.runnerType."s -a -F '#{".runnerType."_id}'"
let l:found = match(VimuxTmux(l:command), g:VimuxRunnerIndex.'\>')
return l:found != -1
endfunction

Expand Down
Loading