@@ -58,7 +58,7 @@ endfunction
5858
5959function ! VimuxSendKeys (keys )
6060 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 )
6262 else
6363 echo " No vimux runner pane/window. Create one with VimuxOpenRunner"
6464 endif
@@ -73,30 +73,30 @@ function! VimuxOpenRunner()
7373 if _VimuxRunnerType () == " pane"
7474 let height = _VimuxOption (" g:VimuxHeight" , 20 )
7575 let orientation = _VimuxOption (" g:VimuxOrientation" , " v" )
76- call system ( " tmux split-window -p " .height." -" .orientation)
76+ call _VimuxTmux ( " split-window -p " .height." -" .orientation)
7777 elseif _VimuxRunnerType () == " window"
78- call system ( " tmux new-window" )
78+ call _VimuxTmux ( " new-window" )
7979 endif
8080
8181 let g: VimuxRunnerIndex = _VimuxTmuxIndex ()
82- call system ( " tmux last-" ._VimuxRunnerType ())
82+ call _VimuxTmux ( " last-" ._VimuxRunnerType ())
8383 endif
8484endfunction
8585
8686function ! VimuxCloseRunner ()
8787 if exists (" g:VimuxRunnerIndex" )
88- call system ( " tmux kill-" ._VimuxRunnerType ()." -t " .g: VimuxRunnerIndex )
88+ call _VimuxTmux ( " kill-" ._VimuxRunnerType ()." -t " .g: VimuxRunnerIndex )
8989 unlet g: VimuxRunnerIndex
9090 endif
9191endfunction
9292
9393function ! VimuxTogglePane ()
9494 if exists (" g:VimuxRunnerIndex" )
9595 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 ))
9797 let g: VimuxRunnerType = " pane"
9898 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 " , " " , " " )
100100 let g: VimuxRunnerType = " window"
101101 endif
102102 endif
@@ -105,27 +105,27 @@ endfunction
105105function ! VimuxZoomRunner ()
106106 if exists (" g:VimuxRunnerIndex" )
107107 if _VimuxRunnerType () == " pane"
108- call system ( " tmux resize-pane -Z -t " .g: VimuxRunnerIndex )
108+ call _VimuxTmux ( " resize-pane -Z -t " .g: VimuxRunnerIndex )
109109 elseif _VimuxRunnerType () == " window"
110- call system ( " tmux select-window -t " .g: VimuxRunnerIndex )
110+ call _VimuxTmux ( " select-window -t " .g: VimuxRunnerIndex )
111111 endif
112112 endif
113113endfunction
114114
115115function ! 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" )
118118endfunction
119119
120120function ! VimuxScrollUpInspect ()
121121 call VimuxInspectRunner ()
122- call system ( " tmux last-" ._VimuxRunnerType ())
122+ call _VimuxTmux ( " last-" ._VimuxRunnerType ())
123123 call VimuxSendKeys (" C-u" )
124124endfunction
125125
126126function ! VimuxScrollDownInspect ()
127127 call VimuxInspectRunner ()
128- call system ( " tmux last-" ._VimuxRunnerType ())
128+ call _VimuxTmux ( " last-" ._VimuxRunnerType ())
129129 call VimuxSendKeys (" C-d" )
130130endfunction
131131
@@ -135,7 +135,7 @@ endfunction
135135
136136function ! VimuxClearRunnerHistory ()
137137 if exists (" g:VimuxRunnerIndex" )
138- call system ( " tmux clear-history -t " .g: VimuxRunnerIndex )
138+ call _VimuxTmux ( " clear-history -t " .g: VimuxRunnerIndex )
139139 endif
140140endfunction
141141
@@ -145,6 +145,11 @@ function! VimuxPromptCommand(...)
145145 call VimuxRunCommand (l: command )
146146endfunction
147147
148+ function ! _VimuxTmux (arguments)
149+ let l: command = _VimuxOption (" g:VimuxTmuxCommand" , " tmux" )
150+ return system (l: command ." " .a: arguments )
151+ endfunction
152+
148153function ! _VimuxTmuxSession ()
149154 return _VimuxTmuxProperty (" #S" )
150155endfunction
@@ -166,7 +171,7 @@ function! _VimuxTmuxWindowIndex()
166171endfunction
167172
168173function ! _VimuxNearestIndex ()
169- let views = split (system ( " tmux list-" ._VimuxRunnerType ()." s" ), " \n " )
174+ let views = split (_VimuxTmux ( " list-" ._VimuxRunnerType ()." s" ), " \n " )
170175
171176 for view in views
172177 if match (view , " (active)" ) == -1
@@ -190,9 +195,9 @@ function! _VimuxOption(option, default)
190195endfunction
191196
192197function ! _VimuxTmuxProperty (property)
193- return substitute (system ( " tmux display -p '" .a: property ." '" ), ' \n$' , ' ' , ' ' )
198+ return substitute (_VimuxTmux ( " display -p '" .a: property ." '" ), ' \n$' , ' ' , ' ' )
194199endfunction
195200
196201function ! _VimuxHasRunner (index )
197- return match (system ( " tmux list-" ._VimuxRunnerType ()." s -a" ), a: index ." :" )
202+ return match (_VimuxTmux ( " list-" ._VimuxRunnerType ()." s -a" ), a: index ." :" )
198203endfunction
0 commit comments