Add ability to change runner type between pane and window

fix-tmux-next-3dot4
Ryan Glover 11 years ago
parent 49a048e94e
commit aa8a444609

@ -63,31 +63,31 @@ function! VimuxOpenRunner()
else else
call system("tmux split-window -p ".height." -".orientation) call system("tmux split-window -p ".height." -".orientation)
let g:VimuxRunnerIndex = _VimuxTmuxIndex() let g:VimuxRunnerIndex = _VimuxTmuxIndex()
call system("tmux last-pane") call system("tmux last-"._VimuxRunnerType())
endif endif
endfunction endfunction
function! VimuxCloseRunner() function! VimuxCloseRunner()
if exists("g:VimuxRunnerIndex") if exists("g:VimuxRunnerIndex")
call system("tmux kill-pane -t ".g:VimuxRunnerIndex) call system("tmux kill-"._VimuxRunnerType()." -t ".g:VimuxRunnerIndex)
unlet g:VimuxRunnerIndex unlet g:VimuxRunnerIndex
endif endif
endfunction endfunction
function! VimuxInspectRunner() function! VimuxInspectRunner()
call system("tmux select-pane -t ".g:VimuxRunnerIndex) call system("tmux select-"._VimuxRunnerType()." -t ".g:VimuxRunnerIndex)
call system("tmux copy-mode") call system("tmux copy-mode")
endfunction endfunction
function! VimuxScrollUpInspect() function! VimuxScrollUpInspect()
call VimuxInspectRunner() call VimuxInspectRunner()
call system("tmux last-pane") call system("tmux last-"._VimuxRunnerType())
call VimuxSendKeys("C-u") call VimuxSendKeys("C-u")
endfunction endfunction
function! VimuxScrollDownInspect() function! VimuxScrollDownInspect()
call VimuxInspectRunner() call VimuxInspectRunner()
call system("tmux last-pane") call system("tmux last-"._VimuxRunnerType())
call VimuxSendKeys("C-d") call VimuxSendKeys("C-d")
endfunction endfunction
@ -119,7 +119,7 @@ function! _VimuxTmuxWindowIndex()
endfunction endfunction
function! _VimuxNearestIndex() function! _VimuxNearestIndex()
let panes = split(system("tmux list-panes"), "\n") let panes = split(system("tmux list-"._VimuxRunnerType()."s"), "\n")
for pane in panes for pane in panes
if match(pane, "(active)") == -1 if match(pane, "(active)") == -1
@ -130,6 +130,10 @@ function! _VimuxNearestIndex()
return -1 return -1
endfunction endfunction
function! _VimuxRunnerType()
return _VimuxOption("g:VimuxRunnerType", "pane")
endfunction
function! _VimuxOption(option, default) function! _VimuxOption(option, default)
if exists(a:option) if exists(a:option)
return eval(a:option) return eval(a:option)
@ -143,5 +147,5 @@ function! _VimuxTmuxProperty(property)
endfunction endfunction
function! _VimuxHasRunner(index) function! _VimuxHasRunner(index)
return match(system("tmux list-panes"), a:index.":") return match(system("tmux list-"._VimuxRunnerType()."s"), a:index.":")
endfunction endfunction

Loading…
Cancel
Save