mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated vimrc
This commit is contained in:
@ -11,16 +11,16 @@
|
||||
" Tested with checkstyle 5.5
|
||||
"============================================================================
|
||||
|
||||
if exists("g:loaded_syntastic_java_checkstyle_checker")
|
||||
if exists('g:loaded_syntastic_java_checkstyle_checker')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_java_checkstyle_checker = 1
|
||||
|
||||
if !exists("g:syntastic_java_checkstyle_classpath")
|
||||
if !exists('g:syntastic_java_checkstyle_classpath')
|
||||
let g:syntastic_java_checkstyle_classpath = 'checkstyle-5.5-all.jar'
|
||||
endif
|
||||
|
||||
if !exists("g:syntastic_java_checkstyle_conf_file")
|
||||
if !exists('g:syntastic_java_checkstyle_conf_file')
|
||||
let g:syntastic_java_checkstyle_conf_file = 'sun_checks.xml'
|
||||
endif
|
||||
|
||||
|
@ -73,6 +73,17 @@ endif
|
||||
|
||||
" }}}1
|
||||
|
||||
" Constants {{{1
|
||||
|
||||
let s:_FILE_SHORTCUTS = {
|
||||
\ '%FILE_PATH%': '%:p',
|
||||
\ '%FILE_NAME%': '%:t',
|
||||
\ '%FILE_DIR%': '%:p:h',
|
||||
\ }
|
||||
lockvar! s:_FILE_SHORTCUTS
|
||||
|
||||
" }}}1
|
||||
|
||||
command! SyntasticJavacEditClasspath call s:EditClasspath()
|
||||
|
||||
if g:syntastic_java_javac_config_file_enabled
|
||||
@ -103,7 +114,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
|
||||
let javac_classpath = ''
|
||||
|
||||
for path in split(g:syntastic_java_javac_classpath, s:ClassSep())
|
||||
if path != ''
|
||||
if path !=# ''
|
||||
try
|
||||
let ps = glob(path, 1, 1)
|
||||
catch
|
||||
@ -128,8 +139,13 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
|
||||
" }}}2
|
||||
|
||||
" load custom classpath {{{2
|
||||
if g:syntastic_java_javac_custom_classpath_command != ''
|
||||
let lines = syntastic#util#system(g:syntastic_java_javac_custom_classpath_command)
|
||||
if g:syntastic_java_javac_custom_classpath_command !=# ''
|
||||
" Pre-process the classpath command string a little.
|
||||
let classpath_command = g:syntastic_java_javac_custom_classpath_command
|
||||
for [key, val] in items(s:_FILE_SHORTCUTS)
|
||||
let classpath_command = substitute(classpath_command, '\V' . key, syntastic#util#shexpand(val), 'g')
|
||||
endfor
|
||||
let lines = syntastic#util#system(classpath_command)
|
||||
if syntastic#util#isRunningWindows() || has('win32unix')
|
||||
let lines = substitute(lines, "\r\n", "\n", 'g')
|
||||
endif
|
||||
@ -138,7 +154,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
|
||||
endfor
|
||||
endif
|
||||
|
||||
if javac_classpath != ''
|
||||
if javac_classpath !=# ''
|
||||
let javac_opts .= ' -cp ' . syntastic#util#shexpand(javac_classpath)
|
||||
endif
|
||||
" }}}2
|
||||
@ -162,7 +178,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
|
||||
\ '%+C%.%#,'.
|
||||
\ '%-G%.%#'
|
||||
|
||||
if output_dir != ''
|
||||
if output_dir !=# ''
|
||||
silent! call mkdir(output_dir, 'p')
|
||||
endif
|
||||
let errors = SyntasticMake({
|
||||
@ -170,7 +186,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'postprocess': ['cygwinRemoveCR'] })
|
||||
|
||||
if output_dir != ''
|
||||
if output_dir !=# ''
|
||||
call syntastic#util#rmrf(output_dir)
|
||||
endif
|
||||
return errors
|
||||
@ -188,10 +204,10 @@ function! s:ClassSep() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:AddToClasspath(classpath, path) " {{{2
|
||||
if a:path == ''
|
||||
if a:path ==# ''
|
||||
return a:classpath
|
||||
endif
|
||||
return (a:classpath != '') ? a:classpath . s:ClassSep() . a:path : a:path
|
||||
return (a:classpath !=# '') ? a:classpath . s:ClassSep() . a:path : a:path
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:SplitClasspath(classpath) " {{{2
|
||||
@ -299,7 +315,7 @@ endfunction " }}}2
|
||||
|
||||
function! s:GetMavenProperties() " {{{2
|
||||
let mvn_properties = {}
|
||||
let pom = findfile('pom.xml', '.;')
|
||||
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
|
||||
if s:has_maven && filereadable(pom)
|
||||
if !has_key(g:syntastic_java_javac_maven_pom_properties, pom)
|
||||
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
|
||||
@ -334,7 +350,7 @@ function! s:GetMavenProperties() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:GetMavenClasspath() " {{{2
|
||||
let pom = findfile('pom.xml', '.;')
|
||||
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
|
||||
if s:has_maven && filereadable(pom)
|
||||
if !has_key(g:syntastic_java_javac_maven_pom_ftime, pom) || g:syntastic_java_javac_maven_pom_ftime[pom] != getftime(pom)
|
||||
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
|
||||
@ -378,7 +394,7 @@ function! s:GetMavenClasspath() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:MavenOutputDirectory() " {{{2
|
||||
let pom = findfile('pom.xml', '.;')
|
||||
let pom = syntastic#util#findFileInParent('pom.xml', expand('%:p:h', 1))
|
||||
if s:has_maven && filereadable(pom)
|
||||
let mvn_properties = s:GetMavenProperties()
|
||||
let output_dir = getcwd()
|
||||
|
Reference in New Issue
Block a user