mirror of
https://github.com/preservim/tagbar.git
synced 2024-11-26 18:33:36 +08: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:
parent
85c198ba57
commit
e5408f740f
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue
Block a user