Skip to content

Commit

Permalink
Merge branch 'feature'
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrieger committed Jul 13, 2016
2 parents c681831 + 9ec2d61 commit 617afb8
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion plugin/vimux.vim
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ endfunction

function! VimuxOpenRunner()
let nearestIndex = _VimuxNearestIndex()
let lastIndex = _VimuxLastIndex()

if _VimuxOption("g:VimuxUseNearest", 1) == 1 && nearestIndex != -1
if _VimuxOption("g:VimuxUseLast", 1) == 1 && lastIndex != -1
let g:VimuxRunnerIndex = lastIndex
elseif _VimuxOption("g:VimuxUseNearest", 1) == 1 && nearestIndex != -1
let g:VimuxRunnerIndex = nearestIndex
else
if _VimuxRunnerType() == "pane"
Expand Down Expand Up @@ -182,6 +185,28 @@ function! _VimuxNearestIndex()
return -1
endfunction

function! _VimuxLastIndex()

let currentID = _VimuxTmuxPaneIndex()

call _VimuxTmux("last-pane")
let lastID = _VimuxTmuxPaneIndex()
call _VimuxTmux("last-pane")

if currentID != lastID
if _VimuxRunnerType() == "window"
return lastID
elseif _VimuxRunnerType() == "pane"
if split(currentID, "\\.")[0] == split(lastID, "\\.")[0]
return lastID
endif
endif
endif

return -1

endfunction

function! _VimuxRunnerType()
return _VimuxOption("g:VimuxRunnerType", "pane")
endfunction
Expand Down

0 comments on commit 617afb8

Please sign in to comment.