@@ -58,7 +58,7 @@ endfunction
58
58
59
59
function ! VimuxSendKeys (keys )
60
60
if exists (" g:VimuxRunnerIndex" )
61
- call system ( " tmux send-keys -t " .g: VimuxRunnerIndex ." " .a: keys )
61
+ call _VimuxTmux ( " send-keys -t " .g: VimuxRunnerIndex ." " .a: keys )
62
62
else
63
63
echo " No vimux runner pane/window. Create one with VimuxOpenRunner"
64
64
endif
@@ -73,30 +73,30 @@ function! VimuxOpenRunner()
73
73
if _VimuxRunnerType () == " pane"
74
74
let height = _VimuxOption (" g:VimuxHeight" , 20 )
75
75
let orientation = _VimuxOption (" g:VimuxOrientation" , " v" )
76
- call system ( " tmux split-window -p " .height." -" .orientation)
76
+ call _VimuxTmux ( " split-window -p " .height." -" .orientation)
77
77
elseif _VimuxRunnerType () == " window"
78
- call system ( " tmux new-window" )
78
+ call _VimuxTmux ( " new-window" )
79
79
endif
80
80
81
81
let g: VimuxRunnerIndex = _VimuxTmuxIndex ()
82
- call system ( " tmux last-" ._VimuxRunnerType ())
82
+ call _VimuxTmux ( " last-" ._VimuxRunnerType ())
83
83
endif
84
84
endfunction
85
85
86
86
function ! VimuxCloseRunner ()
87
87
if exists (" g:VimuxRunnerIndex" )
88
- call system ( " tmux kill-" ._VimuxRunnerType ()." -t " .g: VimuxRunnerIndex )
88
+ call _VimuxTmux ( " kill-" ._VimuxRunnerType ()." -t " .g: VimuxRunnerIndex )
89
89
unlet g: VimuxRunnerIndex
90
90
endif
91
91
endfunction
92
92
93
93
function ! VimuxTogglePane ()
94
94
if exists (" g:VimuxRunnerIndex" )
95
95
if _VimuxRunnerType () == " window"
96
- call system ( " tmux join-pane -d -s " .g: VimuxRunnerIndex ." -p " ._VimuxOption (" g:VimuxHeight" , 20 ))
96
+ call _VimuxTmux ( " join-pane -d -s " .g: VimuxRunnerIndex ." -p " ._VimuxOption (" g:VimuxHeight" , 20 ))
97
97
let g: VimuxRunnerType = " pane"
98
98
elseif _VimuxRunnerType () == " pane"
99
- let g: VimuxRunnerIndex= substitute (system ( " tmux break-pane -d -t " .g: VimuxRunnerIndex ." -P -F '#{window_index}'" ), " \n " , " " , " " )
99
+ let g: VimuxRunnerIndex= substitute (_VimuxTmux ( " break-pane -d -t " .g: VimuxRunnerIndex ." -P -F '#{window_index}'" ), " \n " , " " , " " )
100
100
let g: VimuxRunnerType = " window"
101
101
endif
102
102
endif
@@ -105,27 +105,27 @@ endfunction
105
105
function ! VimuxZoomRunner ()
106
106
if exists (" g:VimuxRunnerIndex" )
107
107
if _VimuxRunnerType () == " pane"
108
- call system ( " tmux resize-pane -Z -t " .g: VimuxRunnerIndex )
108
+ call _VimuxTmux ( " resize-pane -Z -t " .g: VimuxRunnerIndex )
109
109
elseif _VimuxRunnerType () == " window"
110
- call system ( " tmux select-window -t " .g: VimuxRunnerIndex )
110
+ call _VimuxTmux ( " select-window -t " .g: VimuxRunnerIndex )
111
111
endif
112
112
endif
113
113
endfunction
114
114
115
115
function ! VimuxInspectRunner ()
116
- call system ( " tmux select-" ._VimuxRunnerType ()." -t " .g: VimuxRunnerIndex )
117
- call system ( " tmux copy-mode" )
116
+ call _VimuxTmux ( " select-" ._VimuxRunnerType ()." -t " .g: VimuxRunnerIndex )
117
+ call _VimuxTmux ( " copy-mode" )
118
118
endfunction
119
119
120
120
function ! VimuxScrollUpInspect ()
121
121
call VimuxInspectRunner ()
122
- call system ( " tmux last-" ._VimuxRunnerType ())
122
+ call _VimuxTmux ( " last-" ._VimuxRunnerType ())
123
123
call VimuxSendKeys (" C-u" )
124
124
endfunction
125
125
126
126
function ! VimuxScrollDownInspect ()
127
127
call VimuxInspectRunner ()
128
- call system ( " tmux last-" ._VimuxRunnerType ())
128
+ call _VimuxTmux ( " last-" ._VimuxRunnerType ())
129
129
call VimuxSendKeys (" C-d" )
130
130
endfunction
131
131
@@ -135,7 +135,7 @@ endfunction
135
135
136
136
function ! VimuxClearRunnerHistory ()
137
137
if exists (" g:VimuxRunnerIndex" )
138
- call system ( " tmux clear-history -t " .g: VimuxRunnerIndex )
138
+ call _VimuxTmux ( " clear-history -t " .g: VimuxRunnerIndex )
139
139
endif
140
140
endfunction
141
141
@@ -145,6 +145,11 @@ function! VimuxPromptCommand(...)
145
145
call VimuxRunCommand (l: command )
146
146
endfunction
147
147
148
+ function ! _VimuxTmux (arguments)
149
+ let l: command = _VimuxOption (" g:VimuxTmuxCommand" , " tmux" )
150
+ return system (l: command ." " .a: arguments )
151
+ endfunction
152
+
148
153
function ! _VimuxTmuxSession ()
149
154
return _VimuxTmuxProperty (" #S" )
150
155
endfunction
@@ -166,7 +171,7 @@ function! _VimuxTmuxWindowIndex()
166
171
endfunction
167
172
168
173
function ! _VimuxNearestIndex ()
169
- let views = split (system ( " tmux list-" ._VimuxRunnerType ()." s" ), " \n " )
174
+ let views = split (_VimuxTmux ( " list-" ._VimuxRunnerType ()." s" ), " \n " )
170
175
171
176
for view in views
172
177
if match (view , " (active)" ) == -1
@@ -190,9 +195,9 @@ function! _VimuxOption(option, default)
190
195
endfunction
191
196
192
197
function ! _VimuxTmuxProperty (property)
193
- return substitute (system ( " tmux display -p '" .a: property ." '" ), ' \n$' , ' ' , ' ' )
198
+ return substitute (_VimuxTmux ( " display -p '" .a: property ." '" ), ' \n$' , ' ' , ' ' )
194
199
endfunction
195
200
196
201
function ! _VimuxHasRunner (index )
197
- return match (system ( " tmux list-" ._VimuxRunnerType ()." s -a" ), a: index ." :" )
202
+ return match (_VimuxTmux ( " list-" ._VimuxRunnerType ()." s -a" ), a: index ." :" )
198
203
endfunction
0 commit comments