@@ -3,20 +3,20 @@ if exists("g:loaded_vimux") || &cp
3
3
endif
4
4
let g: loaded_vimux = 1
5
5
6
- function ! _VimuxOption (option , default)
6
+ function ! s: VimuxOption (option , default)
7
7
if exists (a: option )
8
8
return eval (a: option )
9
9
else
10
10
return a: default
11
11
endif
12
12
endfunction
13
13
14
- function ! _VimuxTmuxCmd ()
15
- return _VimuxOption (" g:VimuxTmuxCommand" , " tmux" )
14
+ function ! s: VimuxTmuxCmd ()
15
+ return s: VimuxOption (" g:VimuxTmuxCommand" , " tmux" )
16
16
endfunction
17
17
18
- if ! executable (_VimuxTmuxCmd ())
19
- echohl ErrorMsg | echomsg " Failed to find executable " ._VimuxTmuxCmd () | echohl None
18
+ if ! executable (s: VimuxTmuxCmd ())
19
+ echohl ErrorMsg | echomsg " Failed to find executable " .s: VimuxTmuxCmd () | 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" ) || _VimuxHasRunner (g: VimuxRunnerIndex ) == -1
54
+ if ! exists (" g:VimuxRunnerIndex" ) || s: VimuxHasRunner (g: VimuxRunnerIndex ) == -1
55
55
call VimuxOpenRunner ()
56
56
endif
57
57
@@ -60,7 +60,7 @@ function! VimuxRunCommand(command, ...)
60
60
let l: autoreturn = a: 1
61
61
endif
62
62
63
- let resetSequence = _VimuxOption (" g:VimuxResetSequence" , " q C-u" )
63
+ let resetSequence = s: VimuxOption (" g:VimuxResetSequence" , " q C-u" )
64
64
let g: VimuxLastCommand = a: command
65
65
66
66
call VimuxSendKeys (resetSequence)
@@ -77,76 +77,76 @@ endfunction
77
77
78
78
function ! VimuxSendKeys (keys )
79
79
if exists (" g:VimuxRunnerIndex" )
80
- call _VimuxTmux (" send-keys -t " .g: VimuxRunnerIndex ." " .a: keys )
80
+ call s: VimuxTmux (" 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 = _VimuxNearestIndex ()
87
+ let nearestIndex = s: VimuxNearestIndex ()
88
88
89
- if _VimuxOption (" g:VimuxUseNearest" , 1 ) == 1 && nearestIndex != -1
89
+ if s: VimuxOption (" g:VimuxUseNearest" , 1 ) == 1 && nearestIndex != -1
90
90
let g: VimuxRunnerIndex = nearestIndex
91
91
else
92
- let extraArguments = _VimuxOption (" g:VimuxOpenExtraArgs" , " " )
93
- if _VimuxRunnerType () == " pane"
94
- let height = _VimuxOption (" g:VimuxHeight" , 20 )
95
- let orientation = _VimuxOption (" g:VimuxOrientation" , " v" )
96
- call _VimuxTmux (" split-window -p " .height." -" .orientation." " .extraArguments)
97
- elseif _VimuxRunnerType () == " window"
98
- call _VimuxTmux (" new-window " .extraArguments)
92
+ let extraArguments = s: VimuxOption (" g:VimuxOpenExtraArgs" , " " )
93
+ if s: VimuxRunnerType () == " pane"
94
+ let height = s: VimuxOption (" g:VimuxHeight" , 20 )
95
+ let orientation = s: 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)
99
99
endif
100
100
101
- let g: VimuxRunnerIndex = _VimuxTmuxIndex ()
102
- call _VimuxSetRunnerName ()
103
- call _VimuxTmux (" last-" ._VimuxRunnerType ())
101
+ let g: VimuxRunnerIndex = s: VimuxTmuxIndex ()
102
+ call s: VimuxSetRunnerName ()
103
+ call s: VimuxTmux (" last-" .s: VimuxRunnerType ())
104
104
endif
105
105
endfunction
106
106
107
107
function ! VimuxCloseRunner ()
108
108
if exists (" g:VimuxRunnerIndex" )
109
- call _VimuxTmux (" kill-" ._VimuxRunnerType ()." -t " .g: VimuxRunnerIndex )
109
+ call s: VimuxTmux (" kill-" .s: VimuxRunnerType ()." -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 _VimuxRunnerType () == " window"
117
- call _VimuxTmux (" join-pane -d -s " .g: VimuxRunnerIndex ." -p " ._VimuxOption (" g:VimuxHeight" , 20 ))
116
+ if s: VimuxRunnerType () == " window"
117
+ call s: VimuxTmux (" join-pane -d -s " .g: VimuxRunnerIndex ." -p " .s: VimuxOption (" g:VimuxHeight" , 20 ))
118
118
let g: VimuxRunnerType = " pane"
119
- elseif _VimuxRunnerType () == " pane"
120
- let g: VimuxRunnerIndex= substitute (_VimuxTmux (" break-pane -d -t " .g: VimuxRunnerIndex ." -P -F '#{window_id}'" ), " \n " , " " , " " )
119
+ elseif s: VimuxRunnerType () == " pane"
120
+ let g: VimuxRunnerIndex= substitute (s: VimuxTmux (" 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 _VimuxRunnerType () == " pane"
129
- call _VimuxTmux (" resize-pane -Z -t " .g: VimuxRunnerIndex )
130
- elseif _VimuxRunnerType () == " window"
131
- call _VimuxTmux (" select-window -t " .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 )
132
132
endif
133
133
endif
134
134
endfunction
135
135
136
136
function ! VimuxInspectRunner ()
137
- call _VimuxTmux (" select-" ._VimuxRunnerType ()." -t " .g: VimuxRunnerIndex )
138
- call _VimuxTmux (" copy-mode" )
137
+ call s: VimuxTmux (" select-" .s: VimuxRunnerType ()." -t " .g: VimuxRunnerIndex )
138
+ call s: VimuxTmux (" copy-mode" )
139
139
endfunction
140
140
141
141
function ! VimuxScrollUpInspect ()
142
142
call VimuxInspectRunner ()
143
- call _VimuxTmux (" last-" ._VimuxRunnerType ())
143
+ call s: VimuxTmux (" last-" .s: VimuxRunnerType ())
144
144
call VimuxSendKeys (" C-u" )
145
145
endfunction
146
146
147
147
function ! VimuxScrollDownInspect ()
148
148
call VimuxInspectRunner ()
149
- call _VimuxTmux (" last-" ._VimuxRunnerType ())
149
+ call s: VimuxTmux (" last-" .s: VimuxRunnerType ())
150
150
call VimuxSendKeys (" C-d" )
151
151
endfunction
152
152
@@ -162,47 +162,47 @@ endfunction
162
162
163
163
function ! VimuxClearRunnerHistory ()
164
164
if exists (" g:VimuxRunnerIndex" )
165
- call _VimuxTmux (" clear-history -t " .g: VimuxRunnerIndex )
165
+ call s: VimuxTmux (" clear-history -t " .g: VimuxRunnerIndex )
166
166
endif
167
167
endfunction
168
168
169
169
function ! VimuxPromptCommand (... )
170
170
let command = a: 0 == 1 ? a: 1 : " "
171
- let l: command = input (_VimuxOption (" g:VimuxPromptString" , " Command? " ), command , ' shellcmd' )
171
+ let l: command = input (s: VimuxOption (" g:VimuxPromptString" , " Command? " ), command , ' shellcmd' )
172
172
call VimuxRunCommand (l: command )
173
173
endfunction
174
174
175
- function ! _VimuxTmux (arguments)
176
- if _VimuxOption (" g:VimuxDebug" , 0 ) != 0
177
- echom _VimuxTmuxCmd ()." " .a: arguments
175
+ function ! s: VimuxTmux (arguments)
176
+ if s: VimuxOption (" g:VimuxDebug" , 0 ) != 0
177
+ echom s: VimuxTmuxCmd ()." " .a: arguments
178
178
endif
179
- return system (_VimuxTmuxCmd ()." " .a: arguments )
179
+ return system (s: VimuxTmuxCmd ()." " .a: arguments )
180
180
endfunction
181
181
182
- function ! _VimuxTmuxSession ()
183
- return _VimuxTmuxProperty (" #S" )
182
+ function ! s: VimuxTmuxSession ()
183
+ return s: VimuxTmuxProperty (" #S" )
184
184
endfunction
185
185
186
- function ! _VimuxTmuxIndex ()
187
- if _VimuxRunnerType () == " pane"
188
- return _VimuxTmuxPaneId ()
186
+ function ! s: VimuxTmuxIndex ()
187
+ if s: VimuxRunnerType () == " pane"
188
+ return s: VimuxTmuxPaneId ()
189
189
else
190
- return _VimuxTmuxWindowId ()
190
+ return s: VimuxTmuxWindowId ()
191
191
end
192
192
endfunction
193
193
194
- function ! _VimuxTmuxPaneId ()
195
- return _VimuxTmuxProperty (" #{pane_id}" )
194
+ function ! s: VimuxTmuxPaneId ()
195
+ return s: VimuxTmuxProperty (" #{pane_id}" )
196
196
endfunction
197
197
198
- function ! _VimuxTmuxWindowId ()
199
- return _VimuxTmuxProperty (" #{window_id}" )
198
+ function ! s: VimuxTmuxWindowId ()
199
+ return s: VimuxTmuxProperty (" #{window_id}" )
200
200
endfunction
201
201
202
- function ! _VimuxNearestIndex ()
203
- let t = _VimuxRunnerType ()
204
- let filter = _VimuxGetTargetFilter ()
205
- let views = split (_VimuxTmux (" list-" .t ." s -F '#{" .t ." _active}:#{" .t ." _id}'" .filter ), " \n " )
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 " )
206
206
207
207
for view in views
208
208
if match (view , " 1:" ) == -1
@@ -213,42 +213,42 @@ function! _VimuxNearestIndex()
213
213
return -1
214
214
endfunction
215
215
216
- function ! _VimuxGetTargetFilter ()
217
- let targetName = _VimuxOption (" g:VimuxRunnerName" , " " )
216
+ function ! s: VimuxGetTargetFilter ()
217
+ let targetName = s: VimuxOption (" g:VimuxRunnerName" , " " )
218
218
if targetName == " "
219
219
return " "
220
220
endif
221
- let t = _VimuxRunnerType ()
221
+ let t = s: VimuxRunnerType ()
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 ! _VimuxSetRunnerName ()
230
- let targetName = _VimuxOption (" g:VimuxRunnerName" , " " )
229
+ function ! s: VimuxSetRunnerName ()
230
+ let targetName = s: VimuxOption (" g:VimuxRunnerName" , " " )
231
231
if targetName == " "
232
232
return
233
233
endif
234
- let t = _VimuxRunnerType ()
234
+ let t = s: VimuxRunnerType ()
235
235
if t == " window"
236
- call _VimuxTmux (" rename-window " .targetName)
236
+ call s: VimuxTmux (" rename-window " .targetName)
237
237
elseif t == " pane"
238
- call _VimuxTmux (" select-pane -T " .targetName)
238
+ call s: VimuxTmux (" select-pane -T " .targetName)
239
239
endif
240
240
endfunction
241
241
242
242
243
- function ! _VimuxRunnerType ()
244
- return _VimuxOption (" g:VimuxRunnerType" , " pane" )
243
+ function ! s: VimuxRunnerType ()
244
+ return s: VimuxOption (" g:VimuxRunnerType" , " pane" )
245
245
endfunction
246
246
247
- function ! _VimuxTmuxProperty (property)
248
- return substitute (_VimuxTmux (" display -p '" .a: property ." '" ), ' \n$' , ' ' , ' ' )
247
+ function ! s: VimuxTmuxProperty (property)
248
+ return substitute (s: VimuxTmux (" display -p '" .a: property ." '" ), ' \n$' , ' ' , ' ' )
249
249
endfunction
250
250
251
- function ! _VimuxHasRunner (index )
252
- let t = _VimuxRunnerType ()
253
- return match (_VimuxTmux (" list-" .t ." s -F '#{" .t ." _id}'" ), a: index )
251
+ function ! s: VimuxHasRunner (index )
252
+ let t = s: VimuxRunnerType ()
253
+ return match (s: VimuxTmux (" list-" .t ." s -F '#{" .t ." _id}'" ), a: index )
254
254
endfunction
0 commit comments