mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 19:40:27 +01:00
Don't process quickfix-loaded files, closes #176
Certain quickfix-commands like vimgrep have to load all searched files into Vim and will execute the BufReadPost autocmd for all of them. Since Tagbar doesn't need to generate tags for those files pause processing while the command is running. There doesn't seem to be a better way to find out whether vimgrep is running than to set a temporary variable with the QuickFixCmdPre/Post autocmds, see also https://groups.google.com/forum/#!topic/vim_use/sUj5MFGmwD8
This commit is contained in:
@@ -976,6 +976,9 @@ function! s:CreateAutocommands() abort
|
||||
autocmd BufDelete,BufUnload,BufWipeout * call
|
||||
\ s:known_files.rm(fnamemodify(expand('<afile>'), ':p'))
|
||||
|
||||
autocmd QuickFixCmdPre * let s:tagbar_qf_active = 1
|
||||
autocmd QuickFixCmdPost * unlet s:tagbar_qf_active
|
||||
|
||||
autocmd VimEnter * call s:CorrectFocusOnStartup()
|
||||
augroup END
|
||||
|
||||
@@ -3185,6 +3188,12 @@ endfunction
|
||||
function! s:AutoUpdate(fname, force) abort
|
||||
call s:LogDebugMessage('AutoUpdate called [' . a:fname . ']')
|
||||
|
||||
" This file is being loaded due to a quickfix command like vimgrep, so
|
||||
" don't process it
|
||||
if exists('s:tagbar_qf_active')
|
||||
return
|
||||
endif
|
||||
|
||||
" Get the filetype of the file we're about to process
|
||||
let bufnr = bufnr(a:fname)
|
||||
let ftype = getbufvar(bufnr, '&filetype')
|
||||
|
||||
Reference in New Issue
Block a user