diff --git a/plugin/vimux.vim b/plugin/vimux.vim index ebf8e0f..28c7153 100644 --- a/plugin/vimux.vim +++ b/plugin/vimux.vim @@ -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}'"), @@ -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() @@ -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() @@ -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