Minor cleanup: replace match() by stridx() when appropriate.
This commit is contained in:
parent
0714044f98
commit
fa2e6b96d9
@ -44,7 +44,7 @@ function! SyntaxCheckers_go_go_GetLocList() dict
|
|||||||
|
|
||||||
" Test files, i.e. files with a name ending in `_test.go`, are not
|
" Test files, i.e. files with a name ending in `_test.go`, are not
|
||||||
" compiled by `go build`, therefore `go test` must be called for those.
|
" compiled by `go build`, therefore `go test` must be called for those.
|
||||||
if match(expand('%'), '_test.go$') == -1
|
if match(expand('%'), '\m_test\.go$') == -1
|
||||||
let makeprg = 'go build ' . syntastic#c#NullOutput()
|
let makeprg = 'go build ' . syntastic#c#NullOutput()
|
||||||
else
|
else
|
||||||
let makeprg = 'go test -c ' . syntastic#c#NullOutput()
|
let makeprg = 'go test -c ' . syntastic#c#NullOutput()
|
||||||
|
@ -206,7 +206,7 @@ function! s:GetMavenClasspath()
|
|||||||
let mvn_classpath = s:RemoveCarriageReturn(line)
|
let mvn_classpath = s:RemoveCarriageReturn(line)
|
||||||
break
|
break
|
||||||
endif
|
endif
|
||||||
if match(line,'Dependencies classpath:') >= 0
|
if stridx(line,'Dependencies classpath:') >= 0
|
||||||
let class_path_next = 1
|
let class_path_next = 1
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@ -246,13 +246,13 @@ function! s:MavenOutputDirectory()
|
|||||||
if has_key(mvn_properties, 'project.properties.build.dir')
|
if has_key(mvn_properties, 'project.properties.build.dir')
|
||||||
let output_dir = mvn_properties['project.properties.build.dir']
|
let output_dir = mvn_properties['project.properties.build.dir']
|
||||||
endif
|
endif
|
||||||
if match(expand( '%:p:h' ), "src.main.java") >= 0
|
if stridx(expand( '%:p:h' ), "src.main.java") >= 0
|
||||||
let output_dir .= '/target/classes'
|
let output_dir .= '/target/classes'
|
||||||
if has_key(mvn_properties, 'project.build.outputDirectory')
|
if has_key(mvn_properties, 'project.build.outputDirectory')
|
||||||
let output_dir = mvn_properties['project.build.outputDirectory']
|
let output_dir = mvn_properties['project.build.outputDirectory']
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
if match(expand( '%:p:h' ), "src.test.java") >= 0
|
if stridx(expand( '%:p:h' ), "src.test.java") >= 0
|
||||||
let output_dir .= '/target/test-classes'
|
let output_dir .= '/target/test-classes'
|
||||||
if has_key(mvn_properties, 'project.build.testOutputDirectory')
|
if has_key(mvn_properties, 'project.build.testOutputDirectory')
|
||||||
let output_dir = mvn_properties['project.build.testOutputDirectory']
|
let output_dir = mvn_properties['project.build.testOutputDirectory']
|
||||||
|
@ -131,10 +131,10 @@ function! s:GetOtherMakeprg()
|
|||||||
let extension = expand('%:e')
|
let extension = expand('%:e')
|
||||||
let makeprg = ""
|
let makeprg = ""
|
||||||
|
|
||||||
if match(extension, 'mly') >= 0 && executable("menhir")
|
if stridx(extension, 'mly') >= 0 && executable("menhir")
|
||||||
" ocamlyacc output can't be redirected, so use menhir
|
" ocamlyacc output can't be redirected, so use menhir
|
||||||
let makeprg = "menhir --only-preprocess " . syntastic#util#shexpand('%') . " >" . syntastic#util#DevNull()
|
let makeprg = "menhir --only-preprocess " . syntastic#util#shexpand('%') . " >" . syntastic#util#DevNull()
|
||||||
elseif match(extension,'mll') >= 0 && executable("ocamllex")
|
elseif stridx(extension,'mll') >= 0 && executable("ocamllex")
|
||||||
let makeprg = "ocamllex -q " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%')
|
let makeprg = "ocamllex -q " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%')
|
||||||
else
|
else
|
||||||
let makeprg = "camlp4o " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%')
|
let makeprg = "camlp4o " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%')
|
||||||
|
@ -12,14 +12,14 @@ endif
|
|||||||
let g:loaded_syntastic_python_pyflakes_checker = 1
|
let g:loaded_syntastic_python_pyflakes_checker = 1
|
||||||
|
|
||||||
function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i)
|
function! SyntaxCheckers_python_pyflakes_GetHighlightRegex(i)
|
||||||
if match(a:i['text'], 'is assigned to but never used') > -1
|
if stridx(a:i['text'], 'is assigned to but never used') >= 0
|
||||||
\ || match(a:i['text'], 'imported but unused') > -1
|
\ || stridx(a:i['text'], 'imported but unused') >= 0
|
||||||
\ || match(a:i['text'], 'undefined name') > -1
|
\ || stridx(a:i['text'], 'undefined name') >= 0
|
||||||
\ || match(a:i['text'], 'redefinition of') > -1
|
\ || stridx(a:i['text'], 'redefinition of') >= 0
|
||||||
\ || match(a:i['text'], 'referenced before assignment') > -1
|
\ || stridx(a:i['text'], 'referenced before assignment') >= 0
|
||||||
\ || match(a:i['text'], 'duplicate argument') > -1
|
\ || stridx(a:i['text'], 'duplicate argument') >= 0
|
||||||
\ || match(a:i['text'], 'after other statements') > -1
|
\ || stridx(a:i['text'], 'after other statements') >= 0
|
||||||
\ || match(a:i['text'], 'shadowed by loop variable') > -1
|
\ || stridx(a:i['text'], 'shadowed by loop variable') >= 0
|
||||||
|
|
||||||
" fun with Python's %r: try "..." first, then '...'
|
" fun with Python's %r: try "..." first, then '...'
|
||||||
let terms = split(a:i['text'], '"', 1)
|
let terms = split(a:i['text'], '"', 1)
|
||||||
|
@ -20,7 +20,7 @@ if !exists("g:syntastic_ruby_exec")
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
|
function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
|
||||||
if match(a:i['text'], 'assigned but unused variable') > -1
|
if stridx(a:i['text'], 'assigned but unused variable') >= 0
|
||||||
let term = split(a:i['text'], ' - ')[1]
|
let term = split(a:i['text'], ' - ')[1]
|
||||||
return '\V\<'.term.'\>'
|
return '\V\<'.term.'\>'
|
||||||
endif
|
endif
|
||||||
|
@ -20,11 +20,11 @@ function! s:GetShell()
|
|||||||
let b:shell = ''
|
let b:shell = ''
|
||||||
let shebang = getbufline(bufnr('%'), 1)[0]
|
let shebang = getbufline(bufnr('%'), 1)[0]
|
||||||
if len(shebang) > 0
|
if len(shebang) > 0
|
||||||
if match(shebang, 'bash') >= 0
|
if stridx(shebang, 'bash') >= 0
|
||||||
let b:shell = 'bash'
|
let b:shell = 'bash'
|
||||||
elseif match(shebang, 'zsh') >= 0
|
elseif stridx(shebang, 'zsh') >= 0
|
||||||
let b:shell = 'zsh'
|
let b:shell = 'zsh'
|
||||||
elseif match(shebang, 'sh') >= 0
|
elseif stridx(shebang, 'sh') >= 0
|
||||||
let b:shell = 'sh'
|
let b:shell = 'sh'
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user