1
0
mirror of https://github.com/amix/vimrc synced 2025-07-10 03:25:00 +08:00

Updated plugins

This commit is contained in:
amix
2014-10-31 21:30:24 +00:00
parent fe77d23852
commit a304deea56
94 changed files with 5065 additions and 393 deletions

View File

@ -13,12 +13,12 @@ function! g:SyntasticAutoloclistNotifier.New() " {{{2
endfunction " }}}2
function! g:SyntasticAutoloclistNotifier.refresh(loclist) " {{{2
call syntastic#log#debug(g:SyntasticDebugNotifications, 'autoloclist: refresh')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: refresh')
call g:SyntasticAutoloclistNotifier.AutoToggle(a:loclist)
endfunction " }}}2
function! g:SyntasticAutoloclistNotifier.AutoToggle(loclist) " {{{2
call syntastic#log#debug(g:SyntasticDebugNotifications, 'autoloclist: toggle')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'autoloclist: toggle')
if !a:loclist.isEmpty()
if syntastic#util#var('auto_loc_list') == 1
call a:loclist.show()

View File

@ -22,20 +22,11 @@ endfunction " }}}2
" Update the error balloons
function! g:SyntasticBalloonsNotifier.refresh(loclist) " {{{2
let b:syntastic_balloons = {}
unlet! b:syntastic_balloons
if self.enabled() && !a:loclist.isEmpty()
call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: refresh')
let buf = bufnr('')
let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf')
if !empty(issues)
for i in issues
if has_key(b:syntastic_balloons, i['lnum'])
let b:syntastic_balloons[i['lnum']] .= "\n" . i['text']
else
let b:syntastic_balloons[i['lnum']] = i['text']
endif
endfor
set beval bexpr=SyntasticBalloonsExprNotifier()
let b:syntastic_balloons = a:loclist.balloons()
if !empty(b:syntastic_balloons)
set ballooneval balloonexpr=SyntasticBalloonsExprNotifier()
endif
endif
endfunction " }}}2
@ -45,8 +36,9 @@ endfunction " }}}2
function! g:SyntasticBalloonsNotifier.reset(loclist) " {{{2
let b:syntastic_balloons = {}
if has('balloon_eval')
call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: reset')
set nobeval
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'balloons: reset')
unlet! b:syntastic_balloons
set noballooneval
endif
endfunction " }}}2
" @vimlint(EVL103, 0, a:loclist)

View File

@ -13,11 +13,14 @@ function! g:SyntasticChecker.New(args) " {{{2
let newObj._filetype = a:args['filetype']
let newObj._name = a:args['name']
let newObj._exec = get(a:args, 'exec', newObj._name)
let newObj._sort = 0
if has_key(a:args, 'redirect')
let [filetype, name] = split(a:args['redirect'], '/')
let prefix = 'SyntaxCheckers_' . filetype . '_' . name . '_'
if exists('g:syntastic_' . filetype . '_' . name . '_sort') && !exists('g:syntastic_' . newObj._filetype . '_' . newObj._name . '_sort')
let g:syntastic_{newObj._filetype}_{newObj._name}_sort = g:syntastic_{filetype}_{name}_sort
endif
else
let prefix = 'SyntaxCheckers_' . newObj._filetype . '_' . newObj._name . '_'
endif
@ -59,13 +62,13 @@ function! g:SyntasticChecker.getLocListRaw() " {{{2
let name = self._filetype . '/' . self._name
try
let list = self._locListFunc()
call syntastic#log#debug(g:SyntasticDebugTrace, 'getLocList: checker ' . name . ' returned ' . v:shell_error)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_TRACE, 'getLocList: checker ' . name . ' returned ' . v:shell_error)
catch /\m\C^Syntastic: checker error$/
let list = []
call syntastic#log#error('checker ' . name . ' returned abnormal status ' . v:shell_error)
endtry
call self._populateHighlightRegexes(list)
call syntastic#log#debug(g:SyntasticDebugLoclist, name . ' raw:', list)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, name . ' raw:', list)
call self._quietMessages(list)
return list
endfunction " }}}2
@ -74,20 +77,12 @@ function! g:SyntasticChecker.getLocList() " {{{2
return g:SyntasticLoclist.New(self.getLocListRaw())
endfunction " }}}2
function! g:SyntasticChecker.getWantSort() " {{{2
return self._sort
endfunction " }}}2
function! g:SyntasticChecker.setWantSort(val) " {{{2
let self._sort = a:val
endfunction " }}}2
function! g:SyntasticChecker.log(msg, ...) " {{{2
let leader = self._filetype . '/' . self._name . ': '
if a:0 > 0
call syntastic#log#debug(g:SyntasticDebugCheckers, leader . a:msg, a:1)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, leader . a:msg, a:1)
else
call syntastic#log#debug(g:SyntasticDebugCheckers, leader . a:msg)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_CHECKERS, leader . a:msg)
endif
endfunction " }}}2
@ -111,6 +106,18 @@ function! g:SyntasticChecker.isAvailable() " {{{2
return self._available
endfunction " }}}2
function! g:SyntasticChecker.wantSort() " {{{2
return syntastic#util#var(self._filetype . '_' . self._name . '_sort', 0)
endfunction " }}}2
" This method is no longer used by syntastic. It's here only to maintain
" backwards compatibility with external checkers which might depend on it.
function! g:SyntasticChecker.setWantSort(val) " {{{2
if !exists('g:syntastic_' . self._filetype . '_' . self._name . '_sort')
let g:syntastic_{self._filetype}_{self._name}_sort = a:val
endif
endfunction " }}}2
" }}}1
" Private methods {{{1
@ -132,11 +139,11 @@ function! g:SyntasticChecker._quietMessages(errors) " {{{2
call syntastic#log#warn('ignoring invalid syntastic_' . name . '_quiet_messages')
endtry
call syntastic#log#debug(g:SyntasticDebugLoclist, 'quiet_messages filter:', quiet_filters)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'quiet_messages filter:', quiet_filters)
if !empty(quiet_filters)
call syntastic#util#dictFilter(a:errors, quiet_filters)
call syntastic#log#debug(g:SyntasticDebugLoclist, 'filtered by quiet_messages:', a:errors)
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_LOCLIST, 'filtered by quiet_messages:', a:errors)
endif
endfunction " }}}2

View File

@ -18,7 +18,7 @@ endfunction " }}}2
function! g:SyntasticCursorNotifier.refresh(loclist) " {{{2
if self.enabled() && !a:loclist.isEmpty()
call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: refresh')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: refresh')
let b:syntastic_messages = copy(a:loclist.messages(bufnr('')))
let b:syntastic_line = -1
let b:syntastic_cursor_columns = a:loclist.getCursorColumns()
@ -29,7 +29,7 @@ endfunction " }}}2
" @vimlint(EVL103, 1, a:loclist)
function! g:SyntasticCursorNotifier.reset(loclist) " {{{2
call syntastic#log#debug(g:SyntasticDebugNotifications, 'cursor: reset')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'cursor: reset')
autocmd! syntastic CursorMoved
unlet! b:syntastic_messages
let b:syntastic_line = -1

View File

@ -32,7 +32,7 @@ endfunction " }}}2
" Sets error highlights in the cuirrent window
function! g:SyntasticHighlightingNotifier.refresh(loclist) " {{{2
if self.enabled()
call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: refresh')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: refresh')
call self._reset()
let buf = bufnr('')
let issues = filter(a:loclist.copyRaw(), 'v:val["bufnr"] == buf')
@ -63,7 +63,7 @@ endfunction " }}}2
" @vimlint(EVL103, 1, a:loclist)
function! g:SyntasticHighlightingNotifier.reset(loclist) " {{{2
if s:has_highlighting
call syntastic#log#debug(g:SyntasticDebugNotifications, 'highlighting: reset')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'highlighting: reset')
call self._reset()
endif
endfunction " }}}2

View File

@ -173,6 +173,29 @@ function! g:SyntasticLoclist.decorate(tag) " {{{2
endfor
endfunction " }}}2
function! g:SyntasticLoclist.balloons() " {{{2
if !exists("self._cachedBalloons")
let sep = has("balloon_multiline") ? "\n" : ' | '
let self._cachedBalloons = {}
for e in self._rawLoclist
let buf = e['bufnr']
if !has_key(self._cachedBalloons, buf)
let self._cachedBalloons[buf] = {}
endif
if has_key(self._cachedBalloons[buf], e['lnum'])
let self._cachedBalloons[buf][e['lnum']] .= sep . e['text']
else
let self._cachedBalloons[buf][e['lnum']] = e['text']
endif
endfor
endif
return get(self._cachedBalloons, bufnr(''), {})
endfunction " }}}2
function! g:SyntasticLoclist.errors() " {{{2
if !exists("self._cachedErrors")
let self._cachedErrors = self.filter({'type': "E"})
@ -258,14 +281,14 @@ function! g:SyntasticLoclist.setloclist() " {{{2
let w:syntastic_loclist_set = 0
endif
let replace = g:syntastic_reuse_loc_lists && w:syntastic_loclist_set
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)'))
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)'))
call setloclist(0, self.getRaw(), replace ? 'r' : ' ')
let w:syntastic_loclist_set = 1
endfunction " }}}2
"display the cached errors for this buf in the location list
function! g:SyntasticLoclist.show() " {{{2
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: show')
call self.setloclist()
if !self.isEmpty()
@ -300,7 +323,7 @@ endfunction " }}}2
" Non-method functions {{{1
function! SyntasticLoclistHide() " {{{2
call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: hide')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'loclist: hide')
silent! lclose
endfunction " }}}2

View File

@ -63,7 +63,7 @@ function! g:SyntasticModeMap.echoMode() " {{{2
endfunction " }}}2
function! g:SyntasticModeMap.modeInfo(...) " {{{2
echomsg 'Syntastic version: ' . g:syntastic_version
echomsg 'Syntastic version: ' . g:_SYNTASTIC_VERSION
let type = a:0 ? a:1 : &filetype
echomsg 'Info for filetype: ' . type

View File

@ -5,11 +5,11 @@ let g:loaded_syntastic_notifiers = 1
let g:SyntasticNotifiers = {}
let s:notifier_types = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist']
lockvar! s:notifier_types
let s:_NOTIFIER_TYPES = ['signs', 'balloons', 'highlighting', 'cursor', 'autoloclist']
lockvar! s:_NOTIFIER_TYPES
let s:persistent_notifiers = ['signs', 'balloons']
lockvar! s:persistent_notifiers
let s:_PERSISTENT_NOTIFIERS = ['signs', 'balloons']
lockvar! s:_PERSISTENT_NOTIFIERS
" Public methods {{{1
@ -28,11 +28,11 @@ function! g:SyntasticNotifiers.refresh(loclist) " {{{2
return
endif
call syntastic#log#debug(g:SyntasticDebugNotifications, 'notifiers: refresh')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'notifiers: refresh')
for type in self._enabled_types
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
if !has_key(g:{class}, 'enabled') || self._notifier[type].enabled()
if index(s:persistent_notifiers, type) > -1
if index(s:_PERSISTENT_NOTIFIERS, type) > -1
" refresh only if loclist has changed since last call
if !exists('b:syntastic_' . type . '_stamp')
let b:syntastic_{type}_stamp = []
@ -49,7 +49,7 @@ function! g:SyntasticNotifiers.refresh(loclist) " {{{2
endfunction " }}}2
function! g:SyntasticNotifiers.reset(loclist) " {{{2
call syntastic#log#debug(g:SyntasticDebugNotifications, 'notifiers: reset')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'notifiers: reset')
for type in self._enabled_types
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
@ -61,7 +61,7 @@ function! g:SyntasticNotifiers.reset(loclist) " {{{2
endif
" also reset stamps
if index(s:persistent_notifiers, type) > -1
if index(s:_PERSISTENT_NOTIFIERS, type) > -1
let b:syntastic_{type}_stamp = []
endif
endfor
@ -73,12 +73,12 @@ endfunction " }}}2
function! g:SyntasticNotifiers._initNotifiers() " {{{2
let self._notifier = {}
for type in s:notifier_types
for type in s:_NOTIFIER_TYPES
let class = substitute(type, '\m.*', 'Syntastic\u&Notifier', '')
let self._notifier[type] = g:{class}.New()
endfor
let self._enabled_types = copy(s:notifier_types)
let self._enabled_types = copy(s:_NOTIFIER_TYPES)
endfunction " }}}2
" }}}1

View File

@ -5,7 +5,7 @@ let g:loaded_syntastic_registry = 1
" Initialisation {{{1
let s:defaultCheckers = {
let s:_DEFAULT_CHECKERS = {
\ 'actionscript':['mxmlc'],
\ 'ada': ['gcc'],
\ 'applescript': ['osacompile'],
@ -94,9 +94,9 @@ let s:defaultCheckers = {
\ 'zpt': ['zptlint'],
\ 'zsh': ['zsh', 'shellcheck']
\ }
lockvar! s:defaultCheckers
lockvar! s:_DEFAULT_CHECKERS
let s:defaultFiletypeMap = {
let s:_DEFAULT_FILETYPE_MAP = {
\ 'gentoo-metadata': 'xml',
\ 'groff': 'nroff',
\ 'lhaskell': 'haskell',
@ -106,7 +106,7 @@ let s:defaultFiletypeMap = {
\ 'sgml': 'docbk',
\ 'sgmllnx': 'docbk',
\ }
lockvar! s:defaultFiletypeMap
lockvar! s:_DEFAULT_FILETYPE_MAP
let g:SyntasticRegistry = {}
@ -152,7 +152,7 @@ function! g:SyntasticRegistry.getCheckers(ftalias, hints_list) " {{{2
\ !empty(a:hints_list) ? syntastic#util#unique(a:hints_list) :
\ exists('b:syntastic_checkers') ? b:syntastic_checkers :
\ exists('g:syntastic_' . ft . '_checkers') ? g:syntastic_{ft}_checkers :
\ get(s:defaultCheckers, ft, 0)
\ get(s:_DEFAULT_CHECKERS, ft, 0)
return type(names) == type([]) ?
\ self._filterCheckersByName(checkers_map, names) : [checkers_map[keys(checkers_map)[0]]]
@ -165,9 +165,9 @@ function! g:SyntasticRegistry.getCheckersAvailable(ftalias, hints_list) " {{{2
endfunction " }}}2
function! g:SyntasticRegistry.getKnownFiletypes() " {{{2
let types = keys(s:defaultCheckers)
let types = keys(s:_DEFAULT_CHECKERS)
call extend(types, keys(s:defaultFiletypeMap))
call extend(types, keys(s:_DEFAULT_FILETYPE_MAP))
if exists('g:syntastic_filetype_map')
call extend(types, keys(g:syntastic_filetype_map))
@ -262,7 +262,7 @@ endfunction " }}}2
"resolve filetype aliases, and replace - with _ otherwise we cant name
"syntax checker functions legally for filetypes like "gentoo-metadata"
function! s:_normaliseFiletype(ftalias) " {{{2
let ft = get(s:defaultFiletypeMap, a:ftalias, a:ftalias)
let ft = get(s:_DEFAULT_FILETYPE_MAP, a:ftalias, a:ftalias)
let ft = get(g:syntastic_filetype_map, ft, ft)
let ft = substitute(ft, '\m-', '_', 'g')
return ft

View File

@ -36,7 +36,7 @@ function! g:SyntasticSignsNotifier.enabled() " {{{2
endfunction " }}}2
function! g:SyntasticSignsNotifier.refresh(loclist) " {{{2
call syntastic#log#debug(g:SyntasticDebugNotifications, 'signs: refresh')
call syntastic#log#debug(g:_SYNTASTIC_DEBUG_NOTIFICATIONS, 'signs: refresh')
let old_signs = copy(self._bufSignIds())
if self.enabled()
call self._signErrors(a:loclist)