1
0
Fork 0
mirror of synced 2024-06-15 13:31:10 -04:00
ultimate-vim/sources_non_forked/syntastic/plugin/syntastic/balloons.vim
amix 0d8e7370bd Added vim-commentary and updarted the plugins.
commentary:
Comment stuff out.  Use `gcc` to comment out a line (takes a count),
`gc` to comment out the target of a motion (for example, `gcap` to
comment out a paragraph), and `gc` in visual mode to comment out the
selection.  That's it.
2014-03-02 14:35:00 +00:00

67 lines
1.9 KiB
VimL

if exists("g:loaded_syntastic_notifier_balloons") || !exists("g:loaded_syntastic_plugin")
finish
endif
let g:loaded_syntastic_notifier_balloons = 1
if !has('balloon_eval')
let g:syntastic_enable_balloons = 0
endif
let g:SyntasticBalloonsNotifier = {}
" Public methods {{{1
function! g:SyntasticBalloonsNotifier.New() " {{{2
let newObj = copy(self)
return newObj
endfunction " }}}2
function! g:SyntasticBalloonsNotifier.enabled() " {{{2
return has('balloon_eval') && syntastic#util#var('enable_balloons')
endfunction " }}}2
" Update the error balloons
function! g:SyntasticBalloonsNotifier.refresh(loclist) " {{{2
let 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()
endif
endif
endfunction " }}}2
" Reset the error balloons
" @vimlint(EVL103, 1, a:loclist)
function! g:SyntasticBalloonsNotifier.reset(loclist) " {{{2
if has('balloon_eval')
call syntastic#log#debug(g:SyntasticDebugNotifications, 'balloons: reset')
set nobeval
endif
endfunction " }}}2
" @vimlint(EVL103, 0, a:loclist)
" }}}1
" Private functions {{{1
function! SyntasticBalloonsExprNotifier() " {{{2
if !exists('b:syntastic_balloons')
return ''
endif
return get(b:syntastic_balloons, v:beval_lnum, '')
endfunction " }}}2
" }}}1
" vim: set sw=4 sts=4 et fdm=marker: