Change variable and function names to be pane/window agnostic

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

@ -13,7 +13,7 @@ command VimuxPromptCommand :call VimuxPromptCommand()
command VimuxClearRunnerHistory :call VimuxClearRunnerHistory()
function! VimuxRunLastCommand()
if exists("g:VimuxRunnerPaneIndex")
if exists("g:VimuxRunnerIndex")
call VimuxRunCommand(g:VimuxLastCommand)
else
echo "No last vimux command."
@ -21,8 +21,8 @@ function! VimuxRunLastCommand()
endfunction
function! VimuxRunCommand(command, ...)
if !exists("g:VimuxRunnerPaneIndex") || _VimuxHasPane(g:VimuxRunnerPaneIndex) == -1
call VimuxOpenPane()
if !exists("g:VimuxRunnerIndex") || _VimuxHasRunner(g:VimuxRunnerIndex) == -1
call VimuxOpenRunner()
endif
let l:autoreturn = 1
@ -46,36 +46,36 @@ function! VimuxSendText(text)
endfunction
function! VimuxSendKeys(keys)
if exists("g:VimuxRunnerPaneIndex")
call system("tmux send-keys -t ".g:VimuxRunnerPaneIndex." ".a:keys)
if exists("g:VimuxRunnerIndex")
call system("tmux send-keys -t ".g:VimuxRunnerIndex." ".a:keys)
else
echo "No vimux runner pane. Create one with VimuxOpenPane"
echo "No vimux runner pane/window. Create one with VimuxOpenRunner"
endif
endfunction
function! VimuxOpenPane()
function! VimuxOpenRunner()
let height = _VimuxOption("g:VimuxHeight", 20)
let orientation = _VimuxOption("g:VimuxOrientation", "v")
let nearestIndex = _VimuxNearestPaneIndex()
let nearestIndex = _VimuxNearestIndex()
if _VimuxOption("g:VimuxUseNearestPane", 1) == 1 && nearestIndex != -1
let g:VimuxRunnerPaneIndex = nearestIndex
if _VimuxOption("g:VimuxUseNearest", 1) == 1 && nearestIndex != -1
let g:VimuxRunnerIndex = nearestIndex
else
call system("tmux split-window -p ".height." -".orientation)
let g:VimuxRunnerPaneIndex = _VimuxTmuxPaneIndex()
let g:VimuxRunnerIndex = _VimuxTmuxIndex()
call system("tmux last-pane")
endif
endfunction
function! VimuxCloseRunner()
if exists("g:VimuxRunnerPaneIndex")
call system("tmux kill-pane -t ".g:VimuxRunnerPaneIndex)
unlet g:VimuxRunnerPaneIndex
if exists("g:VimuxRunnerIndex")
call system("tmux kill-pane -t ".g:VimuxRunnerIndex)
unlet g:VimuxRunnerIndex
endif
endfunction
function! VimuxInspectRunner()
call system("tmux select-pane -t ".g:VimuxRunnerPaneIndex)
call system("tmux select-pane -t ".g:VimuxRunnerIndex)
call system("tmux copy-mode")
endfunction
@ -96,8 +96,8 @@ function! VimuxInterruptRunner()
endfunction
function! VimuxClearRunnerHistory()
if exists("g:VimuxRunnerPaneIndex")
call system("tmux clear-history -t ".g:VimuxRunnerPaneIndex)
if exists("g:VimuxRunnerIndex")
call system("tmux clear-history -t ".g:VimuxRunnerIndex)
endif
endfunction
@ -110,7 +110,7 @@ function! _VimuxTmuxSession()
return _VimuxTmuxProperty("S")
endfunction
function! _VimuxTmuxPaneIndex()
function! _VimuxTmuxIndex()
return _VimuxTmuxProperty("P")
endfunction
@ -118,7 +118,7 @@ function! _VimuxTmuxWindowIndex()
return _VimuxTmuxProperty("I")
endfunction
function! _VimuxNearestPaneIndex()
function! _VimuxNearestIndex()
let panes = split(system("tmux list-panes"), "\n")
for pane in panes
@ -142,6 +142,6 @@ function! _VimuxTmuxProperty(property)
return substitute(system("tmux display -p '#".a:property."'"), '\n$', '', '')
endfunction
function! _VimuxHasPane(index)
function! _VimuxHasRunner(index)
return match(system("tmux list-panes"), a:index.":")
endfunction

Loading…
Cancel
Save