From cfe2ac68a4103a989f6d5216b25fa986d334baed Mon Sep 17 00:00:00 2001 From: LCD 47 Date: Sat, 16 Nov 2013 12:49:43 +0200 Subject: [PATCH] New command :SyntasticSetLoclist. --- doc/syntastic.txt | 5 +++++ plugin/syntastic.vim | 3 +++ plugin/syntastic/loclist.vim | 14 ++++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/doc/syntastic.txt b/doc/syntastic.txt index 94a5dc1d..8d69d6b4 100644 --- a/doc/syntastic.txt +++ b/doc/syntastic.txt @@ -161,6 +161,11 @@ filetype. Resets the list of errors and turns off all error notifiers. +:SyntasticSetLoclist *:SyntasticSetLoclist* + +Updates Vim's current loclist with the list of detected errors. This is only +needed if |'syntastic_always_populate_loc_list'| is not set. + ============================================================================== 4. Global Options *syntastic-global-options* diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 84933b1c..9d2aa6e8 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -125,6 +125,7 @@ command! SyntasticInfo command! SyntasticReset \ call s:ClearCache() | \ call s:notifiers.refresh(g:SyntasticLoclist.New([])) +command! SyntasticSetLoclist call g:SyntasticLoclist.current().setloclist() highlight link SyntasticError SpellBad highlight link SyntasticWarning SpellCap @@ -211,9 +212,11 @@ function! s:UpdateErrors(auto_invoked, ...) let w:syntastic_loclist_set = 0 if g:syntastic_always_populate_loc_list || g:syntastic_auto_jump + call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist (new)') call setloclist(0, loclist.filteredRaw()) let w:syntastic_loclist_set = 1 if run_checks && g:syntastic_auto_jump && loclist.hasErrorsOrWarningsToDisplay() + call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: jump') silent! lrewind endif endif diff --git a/plugin/syntastic/loclist.vim b/plugin/syntastic/loclist.vim index 217c19ce..42b67a75 100644 --- a/plugin/syntastic/loclist.vim +++ b/plugin/syntastic/loclist.vim @@ -147,14 +147,20 @@ function! g:SyntasticLoclist.filter(filters) return rv endfunction -"display the cached errors for this buf in the location list -function! g:SyntasticLoclist.show() - call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show') +function! g:SyntasticLoclist.setloclist() if !exists('w:syntastic_loclist_set') let w:syntastic_loclist_set = 0 endif - call setloclist(0, self.filteredRaw(), g:syntastic_reuse_loc_lists && w:syntastic_loclist_set ? 'r' : ' ') + let replace = g:syntastic_reuse_loc_lists && w:syntastic_loclist_set + call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: setloclist ' . (replace ? '(replace)' : '(new)')) + call setloclist(0, self.filteredRaw(), replace ? 'r' : ' ') let w:syntastic_loclist_set = 1 +endfunction + +"display the cached errors for this buf in the location list +function! g:SyntasticLoclist.show() + call syntastic#log#debug(g:SyntasticDebugNotifications, 'loclist: show') + call self.setloclist() if self.hasErrorsOrWarningsToDisplay() let num = winnr()