Skip to content

Commit c212352

Browse files
committed
Use robust operators
1 parent f589e21 commit c212352

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

plugin/vimux.vim

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function! VimuxRunLastCommand()
5151
endfunction
5252

5353
function! VimuxRunCommand(command, ...)
54-
if !exists('g:VimuxRunnerIndex') || s:VimuxHasRunner(g:VimuxRunnerIndex) == -1
54+
if !exists('g:VimuxRunnerIndex') || s:VimuxHasRunner(g:VimuxRunnerIndex) ==# -1
5555
call VimuxOpenRunner()
5656
endif
5757

@@ -66,7 +66,7 @@ function! VimuxRunCommand(command, ...)
6666
call VimuxSendKeys(resetSequence)
6767
call VimuxSendText(a:command)
6868

69-
if l:autoreturn == 1
69+
if l:autoreturn ==# 1
7070
call VimuxSendKeys('Enter')
7171
endif
7272
endfunction
@@ -86,15 +86,15 @@ endfunction
8686
function! VimuxOpenRunner()
8787
let nearestIndex = s:VimuxNearestIndex()
8888

89-
if s:VimuxOption('g:VimuxUseNearest', 1) == 1 && nearestIndex != -1
89+
if s:VimuxOption('g:VimuxUseNearest', 1) ==# 1 && nearestIndex != -1
9090
let g:VimuxRunnerIndex = nearestIndex
9191
else
9292
let extraArguments = s:VimuxOption('g:VimuxOpenExtraArgs', '')
93-
if s:VimuxRunnerType() == 'pane'
93+
if s:VimuxRunnerType() ==# 'pane'
9494
let height = s:VimuxOption('g:VimuxHeight', 20)
9595
let orientation = s:VimuxOption('g:VimuxOrientation', 'v')
9696
call s:VimuxTmux('split-window -p '.height.' -'.orientation.' '.extraArguments)
97-
elseif s:VimuxRunnerType() == 'window'
97+
elseif s:VimuxRunnerType() ==# 'window'
9898
call s:VimuxTmux('new-window '.extraArguments)
9999
endif
100100

@@ -113,10 +113,10 @@ endfunction
113113

114114
function! VimuxTogglePane()
115115
if exists('g:VimuxRunnerIndex')
116-
if s:VimuxRunnerType() == 'window'
116+
if s:VimuxRunnerType() ==# 'window'
117117
call s:VimuxTmux('join-pane -d -s '.g:VimuxRunnerIndex.' -p '.s:VimuxOption('g:VimuxHeight', 20))
118118
let g:VimuxRunnerType = 'pane'
119-
elseif s:VimuxRunnerType() == 'pane'
119+
elseif s:VimuxRunnerType() ==# 'pane'
120120
let g:VimuxRunnerIndex=substitute(s:VimuxTmux('break-pane -d -t '.g:VimuxRunnerIndex." -P -F '#{window_id}'"), '\n', '', '')
121121
let g:VimuxRunnerType = 'window'
122122
endif
@@ -125,9 +125,9 @@ endfunction
125125

126126
function! VimuxZoomRunner()
127127
if exists('g:VimuxRunnerIndex')
128-
if s:VimuxRunnerType() == 'pane'
128+
if s:VimuxRunnerType() ==# 'pane'
129129
call s:VimuxTmux('resize-pane -Z -t '.g:VimuxRunnerIndex)
130-
elseif s:VimuxRunnerType() == 'window'
130+
elseif s:VimuxRunnerType() ==# 'window'
131131
call s:VimuxTmux('select-window -t '.g:VimuxRunnerIndex)
132132
endif
133133
endif
@@ -167,7 +167,7 @@ function! VimuxClearRunnerHistory()
167167
endfunction
168168

169169
function! VimuxPromptCommand(...)
170-
let command = a:0 == 1 ? a:1 : ''
170+
let command = a:0 ==# 1 ? a:1 : ''
171171
let l:command = input(s:VimuxOption('g:VimuxPromptString', 'Command? '), command, 'shellcmd')
172172
call VimuxRunCommand(l:command)
173173
endfunction
@@ -184,7 +184,7 @@ function! s:VimuxTmuxSession()
184184
endfunction
185185

186186
function! s:VimuxTmuxIndex()
187-
if s:VimuxRunnerType() == 'pane'
187+
if s:VimuxRunnerType() ==# 'pane'
188188
return s:VimuxTmuxPaneId()
189189
else
190190
return s:VimuxTmuxWindowId()
@@ -205,7 +205,7 @@ function! s:VimuxNearestIndex()
205205
let views = split(s:VimuxTmux('list-'.t."s -F '#{".t.'_active}:#{'.t."_id}'".filter), '\n')
206206

207207
for view in views
208-
if match(view, '1:') == -1
208+
if match(view, '1:') ==# -1
209209
return split(view, ':')[1]
210210
endif
211211
endfor
@@ -215,26 +215,26 @@ endfunction
215215

216216
function! s:VimuxGetTargetFilter()
217217
let targetName = s:VimuxOption('g:VimuxRunnerName', '')
218-
if targetName == ''
218+
if targetName ==# ''
219219
return ''
220220
endif
221221
let t = s:VimuxRunnerType()
222-
if t == 'window'
222+
if t ==# 'window'
223223
return " -f '#{==:#{window_name},".targetName."}'"
224-
elseif t == 'pane'
224+
elseif t ==# 'pane'
225225
return " -f '#{==:#{pane_title},".targetName."}'"
226226
endif
227227
endfunction
228228

229229
function! s:VimuxSetRunnerName()
230230
let targetName = s:VimuxOption('g:VimuxRunnerName', '')
231-
if targetName == ''
231+
if targetName ==# ''
232232
return
233233
endif
234234
let t = s:VimuxRunnerType()
235-
if t == 'window'
235+
if t ==# 'window'
236236
call s:VimuxTmux('rename-window '.targetName)
237-
elseif t == 'pane'
237+
elseif t ==# 'pane'
238238
call s:VimuxTmux('select-pane -T '.targetName)
239239
endif
240240
endfunction

0 commit comments

Comments
 (0)