mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated vimrc
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_plugin = 1
|
||||
@ -19,7 +19,7 @@ if has('reltime')
|
||||
lockvar! g:_SYNTASTIC_START
|
||||
endif
|
||||
|
||||
let g:_SYNTASTIC_VERSION = '3.6.0-57'
|
||||
let g:_SYNTASTIC_VERSION = '3.6.0-122'
|
||||
lockvar g:_SYNTASTIC_VERSION
|
||||
|
||||
" Sanity checks {{{1
|
||||
@ -34,7 +34,7 @@ for s:feature in [
|
||||
\ 'user_commands'
|
||||
\ ]
|
||||
if !has(s:feature)
|
||||
call syntastic#log#error("need Vim compiled with feature " . s:feature)
|
||||
call syntastic#log#error('need Vim compiled with feature ' . s:feature)
|
||||
finish
|
||||
endif
|
||||
endfor
|
||||
@ -104,7 +104,7 @@ for s:key in keys(g:_SYNTASTIC_DEFAULTS)
|
||||
endif
|
||||
endfor
|
||||
|
||||
if exists("g:syntastic_quiet_warnings")
|
||||
if exists('g:syntastic_quiet_warnings')
|
||||
call syntastic#log#oneTimeWarn("variable g:syntastic_quiet_warnings is deprecated, please use let g:syntastic_quiet_messages = {'level': 'warnings'} instead")
|
||||
if g:syntastic_quiet_warnings
|
||||
let s:quiet_warnings = get(g:syntastic_quiet_messages, 'type', [])
|
||||
@ -246,29 +246,29 @@ endif
|
||||
function! s:BufReadPostHook() abort " {{{2
|
||||
if g:syntastic_check_on_open
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufReadPost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
\ 'autocmd: BufReadPost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
|
||||
call s:UpdateErrors(1, [])
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:BufWritePostHook() abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufWritePost, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
\ 'autocmd: BufWritePost, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
|
||||
call s:UpdateErrors(1, [])
|
||||
endfunction " }}}2
|
||||
|
||||
function! s:BufEnterHook() abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: BufEnter, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))) .
|
||||
\ 'autocmd: BufEnter, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))) .
|
||||
\ ', &buftype = ' . string(&buftype))
|
||||
if &buftype == ''
|
||||
if &buftype ==# ''
|
||||
call s:notifiers.refresh(g:SyntasticLoclist.current())
|
||||
elseif &buftype ==# 'quickfix'
|
||||
" TODO: this is needed because in recent versions of Vim lclose
|
||||
" can no longer be called from BufWinLeave
|
||||
" TODO: at this point there is no b:syntastic_loclist
|
||||
let loclist = filter(copy(getloclist(0)), 'v:val["valid"] == 1')
|
||||
let owner = str2nr(getbufvar(bufnr(""), 'syntastic_owner_buffer'))
|
||||
let owner = str2nr(getbufvar(bufnr(''), 'syntastic_owner_buffer'))
|
||||
let buffers = syntastic#util#unique(map(loclist, 'v:val["bufnr"]') + (owner ? [owner] : []))
|
||||
if get(w:, 'syntastic_loclist_set', 0) && !empty(loclist) && empty(filter( buffers, 'syntastic#util#bufIsActive(v:val)' ))
|
||||
call SyntasticLoclistHide()
|
||||
@ -278,7 +278,7 @@ endfunction " }}}2
|
||||
|
||||
function! s:QuitPreHook() abort " {{{2
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_AUTOCOMMANDS,
|
||||
\ 'autocmd: QuitPre, buffer ' . bufnr("") . ' = ' . string(bufname(str2nr(bufnr("")))))
|
||||
\ 'autocmd: QuitPre, buffer ' . bufnr('') . ' = ' . string(bufname(str2nr(bufnr('')))))
|
||||
let b:syntastic_skip_checks = get(b:, 'syntastic_skip_checks', 0) || !syntastic#util#var('check_on_wq')
|
||||
if get(w:, 'syntastic_loclist_set', 0)
|
||||
call SyntasticLoclistHide()
|
||||
@ -304,6 +304,9 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
|
||||
let run_checks = !a:auto_invoked || s:modemap.doAutoChecking()
|
||||
if run_checks
|
||||
call s:CacheErrors(a:checker_names)
|
||||
unlockvar! b:syntastic_changedtick
|
||||
let b:syntastic_changedtick = b:changedtick
|
||||
lockvar! b:syntastic_changedtick
|
||||
endif
|
||||
|
||||
let loclist = g:SyntasticLoclist.current()
|
||||
@ -335,7 +338,7 @@ function! s:UpdateErrors(auto_invoked, checker_names) abort " {{{2
|
||||
" order, which can lead to missing filetype when jumping
|
||||
" to a new file; the following is a workaround for the
|
||||
" resulting brain damage
|
||||
if &filetype == ''
|
||||
if &filetype ==# ''
|
||||
silent! filetype detect
|
||||
endif
|
||||
endif
|
||||
@ -544,11 +547,12 @@ function! SyntasticMake(options) abort " {{{2
|
||||
let &l:errorformat = old_local_errorformat
|
||||
" }}}3
|
||||
|
||||
if !s:_running_windows && (s:_os_name() =~? "FreeBSD" || s:_os_name() =~? "OpenBSD")
|
||||
if !s:_running_windows && (s:_os_name() =~? 'FreeBSD' || s:_os_name() =~? 'OpenBSD')
|
||||
call syntastic#util#redraw(g:syntastic_full_redraws)
|
||||
endif
|
||||
|
||||
if bailout
|
||||
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', err_lines)
|
||||
throw 'Syntastic: checker error'
|
||||
endif
|
||||
|
||||
@ -609,7 +613,7 @@ endfunction " }}}2
|
||||
" Skip running in special buffers
|
||||
function! s:_skip_file() abort " {{{2
|
||||
let fname = expand('%', 1)
|
||||
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype != '') ||
|
||||
let skip = get(b:, 'syntastic_skip_checks', 0) || (&buftype !=# '') ||
|
||||
\ !filereadable(fname) || getwinvar(0, '&diff') || s:_ignore_file(fname) ||
|
||||
\ fnamemodify(fname, ':e') =~? g:syntastic_ignore_extensions
|
||||
if skip
|
||||
@ -627,7 +631,7 @@ function! s:_explain_skip(filetypes) abort " {{{2
|
||||
if get(b:, 'syntastic_skip_checks', 0)
|
||||
call add(why, 'b:syntastic_skip_checks set')
|
||||
endif
|
||||
if &buftype != ''
|
||||
if &buftype !=# ''
|
||||
call add(why, 'buftype = ' . string(&buftype))
|
||||
endif
|
||||
if !filereadable(fname)
|
||||
|
@ -1,4 +1,4 @@
|
||||
if exists("g:loaded_syntastic_notifier_autoloclist") || !exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_notifier_autoloclist') || !exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_notifier_autoloclist = 1
|
||||
|
@ -1,4 +1,4 @@
|
||||
if exists("g:loaded_syntastic_notifier_balloons") || !exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_notifier_balloons') || !exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_notifier_balloons = 1
|
||||
|
@ -1,4 +1,4 @@
|
||||
if exists("g:loaded_syntastic_checker") || !exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_checker') || !exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_checker = 1
|
||||
@ -25,6 +25,10 @@ function! g:SyntasticChecker.New(args) abort " {{{2
|
||||
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
|
||||
endif
|
||||
|
||||
if has_key(a:args, 'enable')
|
||||
let newObj._enable = a:args['enable']
|
||||
endif
|
||||
|
||||
let newObj._locListFunc = function(prefix . 'GetLocList')
|
||||
|
||||
if exists('*' . prefix . 'IsAvailable')
|
||||
@ -54,12 +58,12 @@ endfunction " }}}2
|
||||
" getExec() or getExecEscaped(). Normally isAvailable() does that for you
|
||||
" automatically, but you should keep still this in mind if you change the
|
||||
" current checker workflow.
|
||||
function! g:SyntasticChecker.syncExec() dict " {{{2
|
||||
function! g:SyntasticChecker.syncExec() abort " {{{2
|
||||
let user_exec =
|
||||
\ expand( exists('b:syntastic_' . self._name . '_exec') ? b:syntastic_{self._name}_exec :
|
||||
\ syntastic#util#var(self._filetype . '_' . self._name . '_exec'), 1 )
|
||||
|
||||
if user_exec != '' && user_exec !=# self._exec
|
||||
if user_exec !=# '' && user_exec !=# self._exec
|
||||
let self._exec = user_exec
|
||||
if has_key(self, '_available')
|
||||
" we have a new _exec on the block, it has to be validated
|
||||
@ -78,14 +82,29 @@ endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.getLocListRaw() abort " {{{2
|
||||
let name = self._filetype . '/' . self._name
|
||||
|
||||
if has_key(self, '_enable')
|
||||
let status = syntastic#util#var(self._enable, -1)
|
||||
if status < 0
|
||||
call syntastic#log#error('checker ' . name . ': checks disabled for security reasons; ' .
|
||||
\ 'set g:syntastic_' . self._enable . ' to 1 to override')
|
||||
endif
|
||||
if status <= 0
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' enabled but not forced')
|
||||
return []
|
||||
else
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' forced')
|
||||
endif
|
||||
endif
|
||||
|
||||
try
|
||||
let list = self._locListFunc()
|
||||
if self._exec != ''
|
||||
if self._exec !=# ''
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' returned ' . v:shell_error)
|
||||
endif
|
||||
catch /\m\C^Syntastic: checker error$/
|
||||
let list = []
|
||||
if self._exec != ''
|
||||
if self._exec !=# ''
|
||||
call syntastic#log#error('checker ' . name . ' returned abnormal status ' . v:shell_error)
|
||||
else
|
||||
call syntastic#log#error('checker ' . name . ' aborted')
|
||||
@ -108,7 +127,13 @@ function! g:SyntasticChecker.getVersion(...) abort " {{{2
|
||||
call self.log('getVersion: ' . string(command) . ': ' .
|
||||
\ string(split(version_output, "\n", 1)) .
|
||||
\ (v:shell_error ? ' (exit code ' . v:shell_error . ')' : '') )
|
||||
call self.setVersion(syntastic#util#parseVersion(version_output))
|
||||
let parsed_ver = syntastic#util#parseVersion(version_output)
|
||||
if len(parsed_ver)
|
||||
call self.setVersion(parsed_ver)
|
||||
else
|
||||
call syntastic#log#ndebug(g:_SYNTASTIC_DEBUG_LOCLIST, 'checker output:', split(version_output, "\n", 1))
|
||||
call syntastic#log#error("checker " . self._filetype . "/" . self._name . ": can't parse version string (abnormal termination?)")
|
||||
endif
|
||||
endif
|
||||
return get(self, '_version', [])
|
||||
endfunction " }}}2
|
||||
@ -117,8 +142,6 @@ function! g:SyntasticChecker.setVersion(version) abort " {{{2
|
||||
if len(a:version)
|
||||
let self._version = copy(a:version)
|
||||
call self.log(self.getExec() . ' version =', a:version)
|
||||
else
|
||||
call syntastic#log#error("checker " . self._filetype . "/" . self._name . ": can't parse version string (abnormal termination?)")
|
||||
endif
|
||||
endfunction " }}}2
|
||||
|
||||
@ -152,6 +175,10 @@ function! g:SyntasticChecker.isAvailable() abort " {{{2
|
||||
return self._available
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.isDisabled() abort " {{{2
|
||||
return has_key(self, '_enable') && syntastic#util#var(self._enable, -1) <= 0
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticChecker.wantSort() abort " {{{2
|
||||
return syntastic#util#var(self._filetype . '_' . self._name . '_sort', 0)
|
||||
endfunction " }}}2
|
||||
@ -198,7 +225,7 @@ function! g:SyntasticChecker._populateHighlightRegexes(errors) abort " {{{2
|
||||
for e in a:errors
|
||||
if e['valid']
|
||||
let term = self._highlightRegexFunc(e)
|
||||
if term != ''
|
||||
if term !=# ''
|
||||
let e['hl'] = term
|
||||
endif
|
||||
endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
if exists("g:loaded_syntastic_notifier_cursor") || !exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_notifier_cursor') || !exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_notifier_cursor = 1
|
||||
|
@ -1,4 +1,4 @@
|
||||
if exists("g:loaded_syntastic_notifier_highlighting") || !exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_notifier_highlighting') || !exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_notifier_highlighting = 1
|
||||
@ -29,7 +29,7 @@ function! g:SyntasticHighlightingNotifier.enabled() abort " {{{2
|
||||
return s:has_highlighting && syntastic#util#var('enable_highlighting')
|
||||
endfunction " }}}2
|
||||
|
||||
" Sets error highlights in the cuirrent window
|
||||
" Sets error highlights in the current window
|
||||
function! g:SyntasticHighlightingNotifier.refresh(loclist) abort " {{{2
|
||||
if self.enabled()
|
||||
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: refresh')
|
||||
|
@ -1,4 +1,4 @@
|
||||
if exists("g:loaded_syntastic_loclist") || !exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_loclist') || !exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_loclist = 1
|
||||
@ -13,7 +13,7 @@ function! g:SyntasticLoclist.New(rawLoclist) abort " {{{2
|
||||
let llist = filter(copy(a:rawLoclist), 'v:val["valid"] == 1')
|
||||
|
||||
for e in llist
|
||||
if get(e, 'type', '') == ''
|
||||
if get(e, 'type', '') ==# ''
|
||||
let e['type'] = 'E'
|
||||
endif
|
||||
endfor
|
||||
@ -28,7 +28,7 @@ function! g:SyntasticLoclist.New(rawLoclist) abort " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.current() abort " {{{2
|
||||
if !exists("b:syntastic_loclist") || empty(b:syntastic_loclist)
|
||||
if !exists('b:syntastic_loclist') || empty(b:syntastic_loclist)
|
||||
let b:syntastic_loclist = g:SyntasticLoclist.New([])
|
||||
endif
|
||||
return b:syntastic_loclist
|
||||
@ -57,7 +57,7 @@ function! g:SyntasticLoclist.isEmpty() abort " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.isNewerThan(stamp) abort " {{{2
|
||||
if !exists("self._stamp")
|
||||
if !exists('self._stamp')
|
||||
let self._stamp = []
|
||||
return 0
|
||||
endif
|
||||
@ -81,10 +81,10 @@ function! g:SyntasticLoclist.getCursorColumns() abort " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.getStatuslineFlag() abort " {{{2
|
||||
if !exists("self._stl_format")
|
||||
if !exists('self._stl_format')
|
||||
let self._stl_format = ''
|
||||
endif
|
||||
if !exists("self._stl_flag")
|
||||
if !exists('self._stl_flag')
|
||||
let self._stl_flag = ''
|
||||
endif
|
||||
|
||||
@ -185,8 +185,8 @@ function! g:SyntasticLoclist.decorate(tag) abort " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.balloons() abort " {{{2
|
||||
if !exists("self._cachedBalloons")
|
||||
let sep = has("balloon_multiline") ? "\n" : ' | '
|
||||
if !exists('self._cachedBalloons')
|
||||
let sep = has('balloon_multiline') ? "\n" : ' | '
|
||||
|
||||
let self._cachedBalloons = {}
|
||||
for e in self._rawLoclist
|
||||
@ -208,15 +208,15 @@ function! g:SyntasticLoclist.balloons() abort " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.errors() abort " {{{2
|
||||
if !exists("self._cachedErrors")
|
||||
let self._cachedErrors = self.filter({'type': "E"})
|
||||
if !exists('self._cachedErrors')
|
||||
let self._cachedErrors = self.filter({'type': 'E'})
|
||||
endif
|
||||
return self._cachedErrors
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticLoclist.warnings() abort " {{{2
|
||||
if !exists("self._cachedWarnings")
|
||||
let self._cachedWarnings = self.filter({'type': "W"})
|
||||
if !exists('self._cachedWarnings')
|
||||
let self._cachedWarnings = self.filter({'type': 'W'})
|
||||
endif
|
||||
return self._cachedWarnings
|
||||
endfunction " }}}2
|
||||
@ -229,7 +229,7 @@ endfunction " }}}2
|
||||
|
||||
" cache used by EchoCurrentError()
|
||||
function! g:SyntasticLoclist.messages(buf) abort " {{{2
|
||||
if !exists("self._cachedMessages")
|
||||
if !exists('self._cachedMessages')
|
||||
let self._cachedMessages = {}
|
||||
|
||||
let errors = self.errors() + self.warnings()
|
||||
@ -304,9 +304,9 @@ function! g:SyntasticLoclist.show() abort " {{{2
|
||||
|
||||
if !self.isEmpty()
|
||||
let num = winnr()
|
||||
execute "lopen " . syntastic#util#var('loc_list_height')
|
||||
execute 'lopen ' . syntastic#util#var('loc_list_height')
|
||||
if num != winnr()
|
||||
wincmd p
|
||||
execute num . 'wincmd w'
|
||||
endif
|
||||
|
||||
" try to find the loclist window and set w:quickfix_title
|
||||
@ -320,7 +320,7 @@ function! g:SyntasticLoclist.show() abort " {{{2
|
||||
" errors == getloclist(0) is the only somewhat safe way to
|
||||
" achieve that
|
||||
if strpart(title, 0, 16) ==# ':SyntasticCheck ' ||
|
||||
\ ( (title == '' || title ==# ':setloclist()') && errors == getloclist(0) )
|
||||
\ ( (title ==# '' || title ==# ':setloclist()') && errors == getloclist(0) )
|
||||
call setwinvar(win, 'quickfix_title', ':SyntasticCheck ' . self._name)
|
||||
call setbufvar(buf, 'syntastic_owner_buffer', self._owner)
|
||||
endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
if exists("g:loaded_syntastic_modemap") || !exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_modemap') || !exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_modemap = 1
|
||||
@ -68,7 +68,7 @@ function! g:SyntasticModeMap.toggleMode() abort " {{{2
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.echoMode() abort " {{{2
|
||||
echo "Syntastic: " . self._mode . " mode enabled"
|
||||
echo 'Syntastic: ' . self._mode . ' mode enabled'
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticModeMap.modeInfo(filetypes) abort " {{{2
|
||||
|
@ -1,4 +1,4 @@
|
||||
if exists("g:loaded_syntastic_notifiers") || !exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_notifiers') || !exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_notifiers = 1
|
||||
|
@ -1,4 +1,4 @@
|
||||
if exists("g:loaded_syntastic_registry") || !exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_registry') || !exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_registry = 1
|
||||
@ -53,7 +53,9 @@ let s:_DEFAULT_CHECKERS = {
|
||||
\ 'lua': ['luac'],
|
||||
\ 'markdown': ['mdl'],
|
||||
\ 'matlab': ['mlint'],
|
||||
\ 'mercury': ['mmc'],
|
||||
\ 'nasm': ['nasm'],
|
||||
\ 'nix': ['nix'],
|
||||
\ 'nroff': ['mandoc'],
|
||||
\ 'objc': ['gcc'],
|
||||
\ 'objcpp': ['gcc'],
|
||||
@ -93,7 +95,7 @@ let s:_DEFAULT_CHECKERS = {
|
||||
\ 'yaml': ['jsyaml'],
|
||||
\ 'z80': ['z80syntaxchecker'],
|
||||
\ 'zpt': ['zptlint'],
|
||||
\ 'zsh': ['zsh', 'shellcheck'],
|
||||
\ 'zsh': ['zsh'],
|
||||
\ }
|
||||
lockvar! s:_DEFAULT_CHECKERS
|
||||
|
||||
@ -104,6 +106,7 @@ let s:_DEFAULT_FILETYPE_MAP = {
|
||||
\ 'litcoffee': 'coffee',
|
||||
\ 'mail': 'text',
|
||||
\ 'mkd': 'markdown',
|
||||
\ 'pe-puppet': 'puppet',
|
||||
\ 'sgml': 'docbk',
|
||||
\ 'sgmllnx': 'docbk',
|
||||
\ }
|
||||
@ -178,12 +181,18 @@ function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) abort " {{{2
|
||||
\ self._filterCheckersByName(checkers_map, names) : [checkers_map[keys(checkers_map)[0]]]
|
||||
endfunction " }}}2
|
||||
|
||||
" Same as getCheckers(), but keep only the checkers available. This runs the
|
||||
" Same as getCheckers(), but keep only the available checkers. This runs the
|
||||
" corresponding IsAvailable() functions for all checkers.
|
||||
function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) abort " {{{2
|
||||
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isAvailable()')
|
||||
endfunction " }}}2
|
||||
|
||||
" Same as getCheckers(), but keep only the checkers tyhat are available and
|
||||
" disabled. This runs the corresponding IsAvailable() functions for all checkers.
|
||||
function! g:SyntasticRegistry.getCheckersDisabled(ftalias, hints_list) abort " {{{2
|
||||
return filter(self.getCheckers(a:ftalias, a:hints_list), 'v:val.isDisabled() && v:val.isAvailable()')
|
||||
endfunction " }}}2
|
||||
|
||||
function! g:SyntasticRegistry.getKnownFiletypes() abort " {{{2
|
||||
let types = keys(s:_DEFAULT_CHECKERS)
|
||||
|
||||
@ -211,15 +220,18 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) abort " {{{2
|
||||
if len(ft_list) != 1
|
||||
let available = []
|
||||
let active = []
|
||||
let disabled = []
|
||||
|
||||
for ft in ft_list
|
||||
call extend(available, map( self.getNamesOfAvailableCheckers(ft), 'ft . "/" . v:val' ))
|
||||
call extend(active, map( self.getCheckersAvailable(ft, []), 'ft . "/" . v:val.getName()' ))
|
||||
call extend(disabled, map( self.getCheckersDisabled(ft, []), 'ft . "/" . v:val.getName()' ))
|
||||
endfor
|
||||
else
|
||||
let ft = ft_list[0]
|
||||
let available = self.getNamesOfAvailableCheckers(ft)
|
||||
let active = map(self.getCheckersAvailable(ft, []), 'v:val.getName()')
|
||||
let disabled = map(self.getCheckersDisabled(ft, []), 'v:val.getName()')
|
||||
endif
|
||||
|
||||
let cnt = len(available)
|
||||
@ -232,6 +244,13 @@ function! g:SyntasticRegistry.echoInfoFor(ftalias_list) abort " {{{2
|
||||
let cklist = cnt ? join(active) : '-'
|
||||
echomsg 'Currently enabled checker' . plural . ': ' . cklist
|
||||
|
||||
let cnt = len(disabled)
|
||||
let plural = cnt != 1 ? 's' : ''
|
||||
if len(disabled)
|
||||
let cklist = join(sort(disabled))
|
||||
echomsg 'Checker' . plural . ' disabled for security reasons: ' . cklist
|
||||
endif
|
||||
|
||||
" Eclim feels entitled to mess with syntastic's variables {{{3
|
||||
if exists(':EclimValidate') && get(g:, 'EclimFileTypeValidate', 1)
|
||||
let disabled = filter(copy(ft_list), 's:_disabled_by_eclim(v:val)')
|
||||
@ -284,7 +303,7 @@ function! g:SyntasticRegistry._loadCheckersFor(filetype) abort " {{{2
|
||||
return
|
||||
endif
|
||||
|
||||
execute "runtime! syntax_checkers/" . a:filetype . "/*.vim"
|
||||
execute 'runtime! syntax_checkers/' . a:filetype . '/*.vim'
|
||||
|
||||
if !has_key(self._checkerMap, a:filetype)
|
||||
let self._checkerMap[a:filetype] = {}
|
||||
|
@ -1,4 +1,4 @@
|
||||
if exists("g:loaded_syntastic_notifier_signs") || !exists("g:loaded_syntastic_plugin")
|
||||
if exists('g:loaded_syntastic_notifier_signs') || !exists('g:loaded_syntastic_plugin')
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_notifier_signs = 1
|
||||
@ -107,7 +107,7 @@ function! g:SyntasticSignsNotifier._signErrors(loclist) abort " {{{2
|
||||
let sign_subtype = get(i, 'subtype', '')
|
||||
let sign_type = 'Syntastic' . sign_subtype . sign_severity
|
||||
|
||||
execute "sign place " . s:next_sign_id . " line=" . i['lnum'] . " name=" . sign_type . " buffer=" . i['bufnr']
|
||||
execute 'sign place ' . s:next_sign_id . ' line=' . i['lnum'] . ' name=' . sign_type . ' buffer=' . i['bufnr']
|
||||
call add(self._bufSignIds(), s:next_sign_id)
|
||||
let s:next_sign_id += 1
|
||||
endif
|
||||
@ -119,7 +119,7 @@ endfunction " }}}2
|
||||
function! g:SyntasticSignsNotifier._removeSigns(ids) abort " {{{2
|
||||
if has('signs')
|
||||
for s in reverse(copy(a:ids))
|
||||
execute "sign unplace " . s
|
||||
execute 'sign unplace ' . s
|
||||
call remove(self._bufSignIds(), index(self._bufSignIds(), s))
|
||||
endfor
|
||||
endif
|
||||
@ -127,7 +127,7 @@ endfunction " }}}2
|
||||
|
||||
" Get all the ids of the SyntaxError signs in the buffer
|
||||
function! g:SyntasticSignsNotifier._bufSignIds() abort " {{{2
|
||||
if !exists("b:syntastic_private_sign_ids")
|
||||
if !exists('b:syntastic_private_sign_ids')
|
||||
let b:syntastic_private_sign_ids = []
|
||||
endif
|
||||
return b:syntastic_private_sign_ids
|
||||
|
Reference in New Issue
Block a user