Skip to content

Commit

Permalink
fix loc list auto close. see vim-syntastic#123
Browse files Browse the repository at this point in the history
 - changed BufLeave to BufWinLeave otherwise it would close when
   jumping to loc list.
 - extracted method that auto close/open location list based on
   errors/settings and make sure it reopens loclist when buffer is
   displayed (BufWinEnter) if needed.
  • Loading branch information
millermedeiros committed Dec 16, 2011
1 parent 0d1943e commit d3b122d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugin/syntastic.vim
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,9 @@ augroup syntastic
autocmd cursormoved * call s:EchoCurrentError()
endif

autocmd BufReadPost,BufWritePost,BufEnter * call s:UpdateErrors(1)
autocmd BufUnload,BufLeave * lclose
autocmd BufReadPost,BufWritePost * call s:UpdateErrors(1)
autocmd BufWinEnter * if empty(&bt) | call s:AutoToggleLocList() | endif
autocmd BufUnload,BufWinLeave * lclose
augroup END


Expand All @@ -112,6 +113,11 @@ function! s:UpdateErrors(auto_invoked)
call s:RefreshSigns()
endif

call s:AutoToggleLocList()

endfunction

function s:AutoToggleLocList()
if s:BufHasErrorsOrWarningsToDisplay()
call setloclist(0, b:syntastic_loclist)
if g:syntastic_auto_jump
Expand Down

0 comments on commit d3b122d

Please sign in to comment.