Skip to content

Commit 49a048e

Browse files
committed
Change variable and function names to be pane/window agnostic
1 parent be0a60e commit 49a048e

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

plugin/vimux.vim

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ command VimuxPromptCommand :call VimuxPromptCommand()
1313
command VimuxClearRunnerHistory :call VimuxClearRunnerHistory()
1414

1515
function! VimuxRunLastCommand()
16-
if exists("g:VimuxRunnerPaneIndex")
16+
if exists("g:VimuxRunnerIndex")
1717
call VimuxRunCommand(g:VimuxLastCommand)
1818
else
1919
echo "No last vimux command."
2020
endif
2121
endfunction
2222

2323
function! VimuxRunCommand(command, ...)
24-
if !exists("g:VimuxRunnerPaneIndex") || _VimuxHasPane(g:VimuxRunnerPaneIndex) == -1
25-
call VimuxOpenPane()
24+
if !exists("g:VimuxRunnerIndex") || _VimuxHasRunner(g:VimuxRunnerIndex) == -1
25+
call VimuxOpenRunner()
2626
endif
2727

2828
let l:autoreturn = 1
@@ -46,36 +46,36 @@ function! VimuxSendText(text)
4646
endfunction
4747

4848
function! VimuxSendKeys(keys)
49-
if exists("g:VimuxRunnerPaneIndex")
50-
call system("tmux send-keys -t ".g:VimuxRunnerPaneIndex." ".a:keys)
49+
if exists("g:VimuxRunnerIndex")
50+
call system("tmux send-keys -t ".g:VimuxRunnerIndex." ".a:keys)
5151
else
52-
echo "No vimux runner pane. Create one with VimuxOpenPane"
52+
echo "No vimux runner pane/window. Create one with VimuxOpenRunner"
5353
endif
5454
endfunction
5555

56-
function! VimuxOpenPane()
56+
function! VimuxOpenRunner()
5757
let height = _VimuxOption("g:VimuxHeight", 20)
5858
let orientation = _VimuxOption("g:VimuxOrientation", "v")
59-
let nearestIndex = _VimuxNearestPaneIndex()
59+
let nearestIndex = _VimuxNearestIndex()
6060

61-
if _VimuxOption("g:VimuxUseNearestPane", 1) == 1 && nearestIndex != -1
62-
let g:VimuxRunnerPaneIndex = nearestIndex
61+
if _VimuxOption("g:VimuxUseNearest", 1) == 1 && nearestIndex != -1
62+
let g:VimuxRunnerIndex = nearestIndex
6363
else
6464
call system("tmux split-window -p ".height." -".orientation)
65-
let g:VimuxRunnerPaneIndex = _VimuxTmuxPaneIndex()
65+
let g:VimuxRunnerIndex = _VimuxTmuxIndex()
6666
call system("tmux last-pane")
6767
endif
6868
endfunction
6969

7070
function! VimuxCloseRunner()
71-
if exists("g:VimuxRunnerPaneIndex")
72-
call system("tmux kill-pane -t ".g:VimuxRunnerPaneIndex)
73-
unlet g:VimuxRunnerPaneIndex
71+
if exists("g:VimuxRunnerIndex")
72+
call system("tmux kill-pane -t ".g:VimuxRunnerIndex)
73+
unlet g:VimuxRunnerIndex
7474
endif
7575
endfunction
7676

7777
function! VimuxInspectRunner()
78-
call system("tmux select-pane -t ".g:VimuxRunnerPaneIndex)
78+
call system("tmux select-pane -t ".g:VimuxRunnerIndex)
7979
call system("tmux copy-mode")
8080
endfunction
8181

@@ -96,8 +96,8 @@ function! VimuxInterruptRunner()
9696
endfunction
9797

9898
function! VimuxClearRunnerHistory()
99-
if exists("g:VimuxRunnerPaneIndex")
100-
call system("tmux clear-history -t ".g:VimuxRunnerPaneIndex)
99+
if exists("g:VimuxRunnerIndex")
100+
call system("tmux clear-history -t ".g:VimuxRunnerIndex)
101101
endif
102102
endfunction
103103

@@ -110,15 +110,15 @@ function! _VimuxTmuxSession()
110110
return _VimuxTmuxProperty("S")
111111
endfunction
112112

113-
function! _VimuxTmuxPaneIndex()
113+
function! _VimuxTmuxIndex()
114114
return _VimuxTmuxProperty("P")
115115
endfunction
116116

117117
function! _VimuxTmuxWindowIndex()
118118
return _VimuxTmuxProperty("I")
119119
endfunction
120120

121-
function! _VimuxNearestPaneIndex()
121+
function! _VimuxNearestIndex()
122122
let panes = split(system("tmux list-panes"), "\n")
123123

124124
for pane in panes
@@ -142,6 +142,6 @@ function! _VimuxTmuxProperty(property)
142142
return substitute(system("tmux display -p '#".a:property."'"), '\n$', '', '')
143143
endfunction
144144

145-
function! _VimuxHasPane(index)
145+
function! _VimuxHasRunner(index)
146146
return match(system("tmux list-panes"), a:index.":")
147147
endfunction

0 commit comments

Comments
 (0)