@@ -11,12 +11,12 @@ function! VimuxOption(option, default)
11
11
endif
12
12
endfunction
13
13
14
- function ! s: VimuxTmuxCmd ()
14
+ function ! s: tmuxCmd ()
15
15
return VimuxOption (' g:VimuxTmuxCommand' , ' tmux' )
16
16
endfunction
17
17
18
- if ! executable (s: VimuxTmuxCmd ())
19
- echohl ErrorMsg | echomsg ' Failed to find executable ' .s: VimuxTmuxCmd () | echohl None
18
+ if ! executable (s: tmuxCmd ())
19
+ echohl ErrorMsg | echomsg ' Failed to find executable ' .s: tmuxCmd () | echohl None
20
20
finish
21
21
endif
22
22
@@ -51,7 +51,7 @@ function! VimuxRunLastCommand()
51
51
endfunction
52
52
53
53
function ! VimuxRunCommand (command , ... )
54
- if ! exists (' g:VimuxRunnerIndex' ) || s: VimuxHasRunner (g: VimuxRunnerIndex ) == # -1
54
+ if ! exists (' g:VimuxRunnerIndex' ) || s: hasRunner (g: VimuxRunnerIndex ) == # -1
55
55
call VimuxOpenRunner ()
56
56
endif
57
57
@@ -77,76 +77,76 @@ endfunction
77
77
78
78
function ! VimuxSendKeys (keys )
79
79
if exists (' g:VimuxRunnerIndex' )
80
- call s: VimuxTmux (' send-keys -t ' .g: VimuxRunnerIndex .' ' .a: keys )
80
+ call s: tmux (' send-keys -t ' .g: VimuxRunnerIndex .' ' .a: keys )
81
81
else
82
82
echo ' No vimux runner pane/window. Create one with VimuxOpenRunner'
83
83
endif
84
84
endfunction
85
85
86
86
function ! VimuxOpenRunner ()
87
- let nearestIndex = s: VimuxNearestIndex ()
87
+ let nearestIndex = s: nearestIndex ()
88
88
89
89
if VimuxOption (' g:VimuxUseNearest' , 1 ) == # 1 && nearestIndex != -1
90
90
let g: VimuxRunnerIndex = nearestIndex
91
91
else
92
92
let extraArguments = VimuxOption (' g:VimuxOpenExtraArgs' , ' ' )
93
- if s: VimuxRunnerType () == # ' pane'
93
+ if s: runnerType () == # ' pane'
94
94
let height = VimuxOption (' g:VimuxHeight' , 20 )
95
95
let orientation = VimuxOption (' g:VimuxOrientation' , ' v' )
96
- call s: VimuxTmux (' split-window -p ' .height.' -' .orientation.' ' .extraArguments)
97
- elseif s: VimuxRunnerType () == # ' window'
98
- call s: VimuxTmux (' new-window ' .extraArguments)
96
+ call s: tmux (' split-window -p ' .height.' -' .orientation.' ' .extraArguments)
97
+ elseif s: runnerType () == # ' window'
98
+ call s: tmux (' new-window ' .extraArguments)
99
99
endif
100
100
101
- let g: VimuxRunnerIndex = s: VimuxTmuxIndex ()
102
- call s: VimuxSetRunnerName ()
103
- call s: VimuxTmux (' last-' .s: VimuxRunnerType ())
101
+ let g: VimuxRunnerIndex = s: tmuxIndex ()
102
+ call s: setRunnerName ()
103
+ call s: tmux (' last-' .s: runnerType ())
104
104
endif
105
105
endfunction
106
106
107
107
function ! VimuxCloseRunner ()
108
108
if exists (' g:VimuxRunnerIndex' )
109
- call s: VimuxTmux (' kill-' .s: VimuxRunnerType ().' -t ' .g: VimuxRunnerIndex )
109
+ call s: tmux (' kill-' .s: runnerType ().' -t ' .g: VimuxRunnerIndex )
110
110
unlet g: VimuxRunnerIndex
111
111
endif
112
112
endfunction
113
113
114
114
function ! VimuxTogglePane ()
115
115
if exists (' g:VimuxRunnerIndex' )
116
- if s: VimuxRunnerType () == # ' window'
117
- call s: VimuxTmux (' join-pane -d -s ' .g: VimuxRunnerIndex .' -p ' .VimuxOption (' g:VimuxHeight' , 20 ))
116
+ if s: runnerType () == # ' window'
117
+ call s: tmux (' join-pane -d -s ' .g: VimuxRunnerIndex .' -p ' .VimuxOption (' g:VimuxHeight' , 20 ))
118
118
let g: VimuxRunnerType = ' pane'
119
- elseif s: VimuxRunnerType () == # ' pane'
120
- let g: VimuxRunnerIndex= substitute (s: VimuxTmux (' break-pane -d -t ' .g: VimuxRunnerIndex ." -P -F '#{window_id}'" ), ' \n' , ' ' , ' ' )
119
+ elseif s: runnerType () == # ' pane'
120
+ let g: VimuxRunnerIndex= substitute (s: tmux (' break-pane -d -t ' .g: VimuxRunnerIndex ." -P -F '#{window_id}'" ), ' \n' , ' ' , ' ' )
121
121
let g: VimuxRunnerType = ' window'
122
122
endif
123
123
endif
124
124
endfunction
125
125
126
126
function ! VimuxZoomRunner ()
127
127
if exists (' g:VimuxRunnerIndex' )
128
- if s: VimuxRunnerType () == # ' pane'
129
- call s: VimuxTmux (' resize-pane -Z -t ' .g: VimuxRunnerIndex )
130
- elseif s: VimuxRunnerType () == # ' window'
131
- call s: VimuxTmux (' select-window -t ' .g: VimuxRunnerIndex )
128
+ if s: runnerType () == # ' pane'
129
+ call s: tmux (' resize-pane -Z -t ' .g: VimuxRunnerIndex )
130
+ elseif s: runnerType () == # ' window'
131
+ call s: tmux (' select-window -t ' .g: VimuxRunnerIndex )
132
132
endif
133
133
endif
134
134
endfunction
135
135
136
136
function ! VimuxInspectRunner ()
137
- call s: VimuxTmux (' select-' .s: VimuxRunnerType ().' -t ' .g: VimuxRunnerIndex )
138
- call s: VimuxTmux (' copy-mode' )
137
+ call s: tmux (' select-' .s: runnerType ().' -t ' .g: VimuxRunnerIndex )
138
+ call s: tmux (' copy-mode' )
139
139
endfunction
140
140
141
141
function ! VimuxScrollUpInspect ()
142
142
call VimuxInspectRunner ()
143
- call s: VimuxTmux (' last-' .s: VimuxRunnerType ())
143
+ call s: tmux (' last-' .s: runnerType ())
144
144
call VimuxSendKeys (' C-u' )
145
145
endfunction
146
146
147
147
function ! VimuxScrollDownInspect ()
148
148
call VimuxInspectRunner ()
149
- call s: VimuxTmux (' last-' .s: VimuxRunnerType ())
149
+ call s: tmux (' last-' .s: runnerType ())
150
150
call VimuxSendKeys (' C-d' )
151
151
endfunction
152
152
@@ -162,7 +162,7 @@ endfunction
162
162
163
163
function ! VimuxClearRunnerHistory ()
164
164
if exists (' g:VimuxRunnerIndex' )
165
- call s: VimuxTmux (' clear-history -t ' .g: VimuxRunnerIndex )
165
+ call s: tmux (' clear-history -t ' .g: VimuxRunnerIndex )
166
166
endif
167
167
endfunction
168
168
@@ -172,37 +172,37 @@ function! VimuxPromptCommand(...)
172
172
call VimuxRunCommand (l: command )
173
173
endfunction
174
174
175
- function ! s: VimuxTmux (arguments)
175
+ function ! s: tmux (arguments)
176
176
if VimuxOption (' g:VimuxDebug' , 0 ) != 0
177
- echom s: VimuxTmuxCmd ().' ' .a: arguments
177
+ echom s: tmuxCmd ().' ' .a: arguments
178
178
endif
179
- return system (s: VimuxTmuxCmd ().' ' .a: arguments )
179
+ return system (s: tmuxCmd ().' ' .a: arguments )
180
180
endfunction
181
181
182
- function ! s: VimuxTmuxSession ()
183
- return s: VimuxTmuxProperty (' #S' )
182
+ function ! s: tmuxSession ()
183
+ return s: tmuxProperty (' #S' )
184
184
endfunction
185
185
186
- function ! s: VimuxTmuxIndex ()
187
- if s: VimuxRunnerType () == # ' pane'
188
- return s: VimuxTmuxPaneId ()
186
+ function ! s: tmuxIndex ()
187
+ if s: runnerType () == # ' pane'
188
+ return s: tmuxPaneId ()
189
189
else
190
- return s: VimuxTmuxWindowId ()
190
+ return s: tmuxWindowId ()
191
191
end
192
192
endfunction
193
193
194
- function ! s: VimuxTmuxPaneId ()
195
- return s: VimuxTmuxProperty (' #{pane_id}' )
194
+ function ! s: tmuxPaneId ()
195
+ return s: tmuxProperty (' #{pane_id}' )
196
196
endfunction
197
197
198
- function ! s: VimuxTmuxWindowId ()
199
- return s: VimuxTmuxProperty (' #{window_id}' )
198
+ function ! s: tmuxWindowId ()
199
+ return s: tmuxProperty (' #{window_id}' )
200
200
endfunction
201
201
202
- function ! s: VimuxNearestIndex ()
203
- let t = s: VimuxRunnerType ()
204
- let filter = s: VimuxGetTargetFilter ()
205
- let views = split (s: VimuxTmux (' list-' .t ." s -F '#{" .t .' _active}:#{' .t ." _id}'" .filter ), ' \n' )
202
+ function ! s: nearestIndex ()
203
+ let t = s: runnerType ()
204
+ let filter = s: getTargetFilter ()
205
+ let views = split (s: tmux (' list-' .t ." s -F '#{" .t .' _active}:#{' .t ." _id}'" .filter ), ' \n' )
206
206
207
207
for view in views
208
208
if match (view , ' 1:' ) == # -1
@@ -213,42 +213,42 @@ function! s:VimuxNearestIndex()
213
213
return -1
214
214
endfunction
215
215
216
- function ! s: VimuxGetTargetFilter ()
216
+ function ! s: getTargetFilter ()
217
217
let targetName = VimuxOption (' g:VimuxRunnerName' , ' ' )
218
218
if targetName == # ' '
219
219
return ' '
220
220
endif
221
- let t = s: VimuxRunnerType ()
221
+ let t = s: runnerType ()
222
222
if t == # ' window'
223
223
return " -f '#{==:#{window_name}," .targetName." }'"
224
224
elseif t == # ' pane'
225
225
return " -f '#{==:#{pane_title}," .targetName." }'"
226
226
endif
227
227
endfunction
228
228
229
- function ! s: VimuxSetRunnerName ()
229
+ function ! s: setRunnerName ()
230
230
let targetName = VimuxOption (' g:VimuxRunnerName' , ' ' )
231
231
if targetName == # ' '
232
232
return
233
233
endif
234
- let t = s: VimuxRunnerType ()
234
+ let t = s: runnerType ()
235
235
if t == # ' window'
236
- call s: VimuxTmux (' rename-window ' .targetName)
236
+ call s: tmux (' rename-window ' .targetName)
237
237
elseif t == # ' pane'
238
- call s: VimuxTmux (' select-pane -T ' .targetName)
238
+ call s: tmux (' select-pane -T ' .targetName)
239
239
endif
240
240
endfunction
241
241
242
242
243
- function ! s: VimuxRunnerType ()
243
+ function ! s: runnerType ()
244
244
return VimuxOption (' g:VimuxRunnerType' , ' pane' )
245
245
endfunction
246
246
247
- function ! s: VimuxTmuxProperty (property)
248
- return substitute (s: VimuxTmux (" display -p '" .a: property ." '" ), ' \n$' , ' ' , ' ' )
247
+ function ! s: tmuxProperty (property)
248
+ return substitute (s: tmux (" display -p '" .a: property ." '" ), ' \n$' , ' ' , ' ' )
249
249
endfunction
250
250
251
- function ! s: VimuxHasRunner (index )
252
- let t = s: VimuxRunnerType ()
253
- return match (s: VimuxTmux (' list-' .t ." s -F '#{" .t ." _id}'" ), a: index )
251
+ function ! s: hasRunner (index )
252
+ let t = s: runnerType ()
253
+ return match (s: tmux (' list-' .t ." s -F '#{" .t ." _id}'" ), a: index )
254
254
endfunction
0 commit comments