Skip to content

Commit 7212ae4

Browse files
committed
Fix finding index to be based on runner type
1 parent aa8a444 commit 7212ae4

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

plugin/vimux.vim

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,19 @@ function! VimuxSendKeys(keys)
5454
endfunction
5555

5656
function! VimuxOpenRunner()
57-
let height = _VimuxOption("g:VimuxHeight", 20)
58-
let orientation = _VimuxOption("g:VimuxOrientation", "v")
5957
let nearestIndex = _VimuxNearestIndex()
6058

6159
if _VimuxOption("g:VimuxUseNearest", 1) == 1 && nearestIndex != -1
6260
let g:VimuxRunnerIndex = nearestIndex
6361
else
64-
call system("tmux split-window -p ".height." -".orientation)
62+
if _VimuxRunnerType() == "pane"
63+
let height = _VimuxOption("g:VimuxHeight", 20)
64+
let orientation = _VimuxOption("g:VimuxOrientation", "v")
65+
call system("tmux split-window -p ".height." -".orientation)
66+
elseif _VimuxRunnerType() == "window"
67+
call system("tmux new-window")
68+
endif
69+
6570
let g:VimuxRunnerIndex = _VimuxTmuxIndex()
6671
call system("tmux last-"._VimuxRunnerType())
6772
endif
@@ -111,7 +116,15 @@ function! _VimuxTmuxSession()
111116
endfunction
112117

113118
function! _VimuxTmuxIndex()
114-
return _VimuxTmuxProperty("P")
119+
if _VimuxRunnerType == "pane"
120+
return _VimuxTmuxPaneIndex()
121+
else
122+
return _VimuxTmuxWindowIndex()
123+
end
124+
endfunction
125+
126+
function! _VimuxTmuxPaneIndex()
127+
return _VimuxTmuxProperty("P")
115128
endfunction
116129

117130
function! _VimuxTmuxWindowIndex()

0 commit comments

Comments
 (0)