mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated plugins
This commit is contained in:
@ -17,7 +17,7 @@ endif
|
||||
let g:loaded_syntastic_java_checkstyle_checker = 1
|
||||
|
||||
if !exists('g:syntastic_java_checkstyle_classpath')
|
||||
let g:syntastic_java_checkstyle_classpath = 'checkstyle-5.5-all.jar'
|
||||
let g:syntastic_java_checkstyle_classpath = 'checkstyle-6.10.1-all.jar'
|
||||
endif
|
||||
|
||||
if !exists('g:syntastic_java_checkstyle_conf_file')
|
||||
@ -32,30 +32,38 @@ function! SyntaxCheckers_java_checkstyle_IsAvailable() dict
|
||||
return 0
|
||||
endif
|
||||
|
||||
let classpath = expand(g:syntastic_java_checkstyle_classpath, 1)
|
||||
let conf_file = expand(g:syntastic_java_checkstyle_conf_file, 1)
|
||||
call self.log(
|
||||
\ 'filereadable(' . string(classpath) . ') = ' . filereadable(classpath) . ', ' .
|
||||
\ 'filereadable(' . string(conf_file) . ') = ' . filereadable(conf_file))
|
||||
call self.log('filereadable(' . string(conf_file) . ') = ' . filereadable(conf_file))
|
||||
|
||||
return filereadable(classpath) && filereadable(conf_file)
|
||||
return filereadable(conf_file)
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_java_checkstyle_GetLocList() dict
|
||||
|
||||
let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) )
|
||||
" classpath
|
||||
if !exists('s:sep')
|
||||
let s:sep = syntastic#util#isRunningWindows() || has('win32unix') ? ';' : ':'
|
||||
endif
|
||||
let classpath = join(map( split(g:syntastic_java_checkstyle_classpath, s:sep, 1), 'expand(v:val, 1)' ), s:sep)
|
||||
call self.log('classpath =', classpath)
|
||||
|
||||
" forced options
|
||||
let opts = []
|
||||
if classpath !=# ''
|
||||
call extend(opts, ['-cp', classpath])
|
||||
endif
|
||||
call extend(opts, [
|
||||
\ 'com.puppycrawl.tools.checkstyle.Main',
|
||||
\ '-c', expand(g:syntastic_java_checkstyle_conf_file, 1),
|
||||
\ '-f', 'xml' ])
|
||||
|
||||
" filename
|
||||
let fname = syntastic#util#shescape( expand('%:p:h', 1) . syntastic#util#Slash() . expand('%:t', 1) )
|
||||
if has('win32unix')
|
||||
let fname = substitute(syntastic#util#system('cygpath -m ' . fname), '\m\%x00', '', 'g')
|
||||
endif
|
||||
|
||||
let makeprg = self.makeprgBuild({
|
||||
\ 'args_after': [
|
||||
\ '-cp', expand(g:syntastic_java_checkstyle_classpath, 1),
|
||||
\ 'com.puppycrawl.tools.checkstyle.Main',
|
||||
\ '-c', expand(g:syntastic_java_checkstyle_conf_file, 1),
|
||||
\ '-f', 'xml'],
|
||||
\ 'fname': fname })
|
||||
let makeprg = self.makeprgBuild({ 'args_after': opts, 'fname': fname })
|
||||
|
||||
let errorformat = '%f:%t:%l:%c:%m'
|
||||
|
||||
|
@ -84,11 +84,12 @@ lockvar! s:_FILE_SHORTCUTS
|
||||
|
||||
" }}}1
|
||||
|
||||
command! SyntasticJavacEditClasspath call s:EditClasspath()
|
||||
" Commands {{{1
|
||||
|
||||
if g:syntastic_java_javac_config_file_enabled
|
||||
command! SyntasticJavacEditConfig call s:EditConfig()
|
||||
endif
|
||||
command! SyntasticJavacEditClasspath call s:EditClasspath()
|
||||
command! SyntasticJavacEditConfig call s:EditConfig()
|
||||
|
||||
" }}}1
|
||||
|
||||
function! SyntaxCheckers_java_javac_IsAvailable() dict " {{{1
|
||||
let s:has_maven = executable(expand(g:syntastic_java_maven_executable, 1))
|
||||
@ -173,9 +174,8 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
|
||||
let errorformat =
|
||||
\ '%E%f:%l: error: %m,'.
|
||||
\ '%W%f:%l: warning: %m,'.
|
||||
\ '%A%f:%l: %m,'.
|
||||
\ '%+Z%p^,'.
|
||||
\ '%+C%.%#,'.
|
||||
\ '%E%f:%l: %m,'.
|
||||
\ '%Z%p^,'.
|
||||
\ '%-G%.%#'
|
||||
|
||||
if output_dir !=# ''
|
||||
@ -290,6 +290,10 @@ function! s:SaveConfig() " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:EditConfig() " {{{2
|
||||
if !g:syntastic_java_javac_config_file_enabled
|
||||
return
|
||||
endif
|
||||
|
||||
let command = 'syntastic javac config'
|
||||
let winnr = bufwinnr('^' . command . '$')
|
||||
if winnr < 0
|
||||
@ -356,7 +360,7 @@ function! s:GetMavenClasspath() " {{{2
|
||||
let mvn_cmd = syntastic#util#shexpand(g:syntastic_java_maven_executable) .
|
||||
\ ' -f ' . syntastic#util#shescape(pom) .
|
||||
\ ' ' . g:syntastic_java_maven_options
|
||||
let mvn_classpath_output = split(syntastic#util#system(mvn_cmd . ' dependency:build-classpath'), "\n")
|
||||
let mvn_classpath_output = split(syntastic#util#system(mvn_cmd . ' dependency:build-classpath -DincludeScope=test'), "\n")
|
||||
let mvn_classpath = ''
|
||||
let class_path_next = 0
|
||||
|
||||
@ -373,16 +377,10 @@ function! s:GetMavenClasspath() " {{{2
|
||||
let mvn_properties = s:GetMavenProperties()
|
||||
|
||||
let sep = syntastic#util#Slash()
|
||||
let output_dir = join(['target', 'classes'], sep)
|
||||
if has_key(mvn_properties, 'project.build.outputDirectory')
|
||||
let output_dir = mvn_properties['project.build.outputDirectory']
|
||||
endif
|
||||
let output_dir = get(mvn_properties, 'project.build.outputDirectory', join(['target', 'classes'], sep))
|
||||
let mvn_classpath = s:AddToClasspath(mvn_classpath, output_dir)
|
||||
|
||||
let test_output_dir = join(['target', 'test-classes'], sep)
|
||||
if has_key(mvn_properties, 'project.build.testOutputDirectory')
|
||||
let test_output_dir = mvn_properties['project.build.testOutputDirectory']
|
||||
endif
|
||||
let test_output_dir = get(mvn_properties, 'project.build.testOutputDirectory', join(['target', 'test-classes'], sep))
|
||||
let mvn_classpath = s:AddToClasspath(mvn_classpath, test_output_dir)
|
||||
|
||||
let g:syntastic_java_javac_maven_pom_ftime[pom] = getftime(pom)
|
||||
@ -397,23 +395,16 @@ function! s:MavenOutputDirectory() " {{{2
|
||||
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()
|
||||
if has_key(mvn_properties, 'project.properties.build.dir')
|
||||
let output_dir = mvn_properties['project.properties.build.dir']
|
||||
endif
|
||||
let output_dir = get(mvn_properties, 'project.properties.build.dir', getcwd())
|
||||
|
||||
let sep = syntastic#util#Slash()
|
||||
if stridx(expand('%:p:h', 1), join(['src', 'main', 'java'], sep)) >= 0
|
||||
let output_dir = join ([output_dir, 'target', 'classes'], sep)
|
||||
if has_key(mvn_properties, 'project.build.outputDirectory')
|
||||
let output_dir = mvn_properties['project.build.outputDirectory']
|
||||
endif
|
||||
let src_main_dir = get(mvn_properties, 'project.build.sourceDirectory', join(['src', 'main', 'java'], sep))
|
||||
let src_test_dir = get(mvn_properties, 'project.build.testsourceDirectory', join(['src', 'test', 'java'], sep))
|
||||
if stridx(expand('%:p:h', 1), src_main_dir) >= 0
|
||||
let output_dir = get(mvn_properties, 'project.build.outputDirectory', join ([output_dir, 'target', 'classes'], sep))
|
||||
endif
|
||||
if stridx(expand('%:p:h', 1), join(['src', 'test', 'java'], sep)) >= 0
|
||||
let output_dir = join([output_dir, 'target', 'test-classes'], sep)
|
||||
if has_key(mvn_properties, 'project.build.testOutputDirectory')
|
||||
let output_dir = mvn_properties['project.build.testOutputDirectory']
|
||||
endif
|
||||
if stridx(expand('%:p:h', 1), src_test_dir) >= 0
|
||||
let output_dir = get(mvn_properties, 'project.build.testOutputDirectory', join([output_dir, 'target', 'test-classes'], sep))
|
||||
endif
|
||||
|
||||
if has('win32unix')
|
||||
|
Reference in New Issue
Block a user