1
0
mirror of https://github.com/amix/vimrc synced 2025-06-23 23:15:01 +08:00

Updated plugins and added vim-jade

This commit is contained in:
amix
2016-01-05 15:18:45 -03:00
parent 3aabd8befd
commit 795a8fb80d
35 changed files with 1036 additions and 131 deletions

View File

@ -156,6 +156,37 @@ function! syntastic#preprocess#iconv(errors) abort " {{{2
\ a:errors
endfunction " }}}2
function! syntastic#preprocess#jscs(errors) abort " {{{2
let errs = join(a:errors, '')
if errs ==# ''
return []
endif
let json = s:_decode_JSON(errs)
let out = []
if type(json) == type({})
for fname in keys(json)
if type(json[fname]) == type([])
for e in json[fname]
try
let e['message'] = substitute(e['message'], "\n", ' ', 'g')
cal add(out, fname . ':' . e['line'] . ':' . e['column'] . ':' . e['message'])
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker javascript/jscs: unrecognized error item ' . string(e))
let out = []
endtry
endfor
else
call syntastic#log#warn('checker javascript/jscs: unrecognized error format')
endif
endfor
else
call syntastic#log#warn('checker javascript/jscs: unrecognized error format')
endif
return out
endfunction " }}}2
function! syntastic#preprocess#killEmpty(errors) abort " {{{2
return filter(copy(a:errors), 'v:val !=# ""')
endfunction " }}}2
@ -269,15 +300,16 @@ function! syntastic#preprocess#stylelint(errors) abort " {{{2
for e in errs[0]['warnings']
try
let severity = type(e['severity']) == type(0) ? ['W', 'E'][e['severity']-1] : e['severity'][0]
let msg =
\ ['W', 'E'][e['severity']-1] . ':' .
\ severity . ':' .
\ errs[0]['source'] . ':' .
\ e['line'] . ':' .
\ e['column'] . ':' .
\ e['text']
call add(out, msg)
catch /\m^Vim\%((\a\+)\)\=:E716/
call syntastic#log#warn('checker css/stylelint: unrecognized error format')
call syntastic#log#warn('checker css/stylelint: unrecognized error item ' . string(e))
let out = []
break
endtry

View File

@ -439,7 +439,8 @@ Default: 2
Use this option to tell syntastic to automatically open and/or close the
|location-list| (see |syntastic-error-window|).
When set to 0 the error window will not be opened or closed automatically. >
When set to 0 the error window will be neither opened nor closed
automatically. >
let g:syntastic_auto_loc_list = 0
<
When set to 1 the error window will be automatically opened when errors are
@ -449,6 +450,10 @@ detected, and closed when none are detected. >
When set to 2 the error window will be automatically closed when no errors are
detected, but not opened automatically. >
let g:syntastic_auto_loc_list = 2
<
When set to 3 the error window will be automatically opened when errors are
detected, but not closed automatically. >
let g:syntastic_auto_loc_list = 3
<
*'syntastic_loc_list_height'*
Default: 10
@ -956,14 +961,12 @@ mode only work with "vim-auto-save" version 0.1.7 or later.
------------------------------------------------------------------------------
7.10. vim-go *syntastic-vim-go*
The "vim-go" Vim plugin (https://github.com/fatih/vim-go) uses |quickfix|
lists, and thus doesn't conflict with syntastic (which uses |location-list|
lists). However, both "vim-go" and syntastic run syntax checks by default
when you save buffers to disk, and this can have confusing results. To
avoid both plugins opening error windows, you can either set passive
mode for go in syntastic (see |syntastic_mode_map|), or prevent "vim-go"
from showing a quickfix window when |g:go_fmt_command| fails, by setting
|g:go_fmt_fail_silently| to 1. E.g.: >
Syntastic can be used along with the "vim-go" Vim plugin (see
https://github.com/fatih/vim-go). However, both "vim-go" and syntastic run
syntax checks by default when you save buffers to disk. To avoid conflicts,
you have to either set passive mode in syntastic for the go filetype (see
|syntastic_mode_map|), or prevent "vim-go" from showing a quickfix window when
|g:go_fmt_command| fails, by setting |g:go_fmt_fail_silently| to 1. E.g.: >
let g:go_fmt_fail_silently = 1
<
------------------------------------------------------------------------------

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.7.0-62'
let g:_SYNTASTIC_VERSION = '3.7.0-69'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1
@ -510,6 +510,7 @@ function! SyntasticMake(options) abort " {{{2
if has_key(a:options, 'errorformat')
let &errorformat = a:options['errorformat']
set errorformat<
endif
if has_key(a:options, 'cwd')
@ -662,7 +663,8 @@ function! s:_skip_file() abort " {{{2
let fname = expand('%', 1)
let skip = s:_is_quitting(bufnr('%')) || get(b:, 'syntastic_skip_checks', 0) ||
\ (&buftype !=# '') || !filereadable(fname) || getwinvar(0, '&diff') ||
\ s:_ignore_file(fname) || fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
\ getwinvar(0, '&previewwindow') || s:_ignore_file(fname) ||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
if skip
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, '_skip_file: skipping checks')
endif
@ -690,6 +692,9 @@ function! s:_explain_skip(filetypes) abort " {{{2
if getwinvar(0, '&diff')
call add(why, 'diff mode')
endif
if getwinvar(0, '&previewwindow')
call add(why, 'preview window')
endif
if s:_ignore_file(fname)
call add(why, 'filename matching g:syntastic_ignore_files')
endif

View File

@ -19,13 +19,13 @@ endfunction " }}}2
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) abort " {{{2
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: toggle')
let auto_loc_list = syntastic#util#var('auto_loc_list')
if !a:loclist.isEmpty()
if syntastic#util#var('auto_loc_list') == 1
if auto_loc_list == 1 || auto_loc_list == 3
call a:loclist.show()
endif
else
if syntastic#util#var('auto_loc_list') > 0
if auto_loc_list == 1 || auto_loc_list == 2
"TODO: this will close the loc list window if one was opened by
"something other than syntastic
lclose

View File

@ -21,16 +21,24 @@ endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_javascript_jscs_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '--no-colors --reporter checkstyle' })
function! SyntaxCheckers_javascript_jscs_IsAvailable() dict
if !executable(self.getExec())
return 0
endif
return syntastic#util#versionIsAtLeast(self.getVersion(), [2, 1])
endfunction
let errorformat = '%f:%t:%l:%c:%m'
function! SyntaxCheckers_javascript_jscs_GetLocList() dict
let makeprg = self.makeprgBuild({ 'args_after': '--no-colors --reporter json' })
let errorformat = '%f:%l:%c:%m'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'subtype': 'Style',
\ 'preprocess': 'checkstyle',
\ 'preprocess': 'jscs',
\ 'defaults': {'type': 'E'},
\ 'returns': [0, 2] })
endfunction