mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 11:30:28 +01:00
Update on save for smaller files, closes #40
This commit is contained in:
@@ -887,6 +887,10 @@ function! s:CreateAutocommands()
|
||||
autocmd BufUnload __Tagbar__ call s:CleanUp()
|
||||
autocmd CursorHold __Tagbar__ call s:ShowPrototype()
|
||||
|
||||
autocmd BufWritePost *
|
||||
\ if line('$') < g:tagbar_updateonsave_maxlines |
|
||||
\ call s:AutoUpdate(fnamemodify(expand('<afile>'), ':p')) |
|
||||
\ endif
|
||||
autocmd BufEnter,CursorHold * call
|
||||
\ s:AutoUpdate(fnamemodify(expand('<afile>'), ':p'))
|
||||
autocmd BufDelete * call
|
||||
|
||||
@@ -432,6 +432,22 @@ Example:
|
||||
let g:tagbar_autoshowtag = 1
|
||||
<
|
||||
|
||||
*g:tagbar_updateonsave_maxlines*
|
||||
g:tagbar_updateonsave_maxlines~
|
||||
Default: 5000
|
||||
|
||||
If the current file has fewer lines than the value of this variable, Tagbar
|
||||
will update immediately after saving the file. If it is longer then the update
|
||||
will only happen on the |CursorHold| event and when switching buffers (or
|
||||
windows). This is to prevent the time it takes to save a large file from
|
||||
becoming annoying in case you have a slow computer. If you have a fast
|
||||
computer you can set it to a higher value.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_updateonsave_maxlines = 10000
|
||||
<
|
||||
|
||||
*g:tagbar_systemenc*
|
||||
g:tagbar_systemenc~
|
||||
Default: value of 'encoding'
|
||||
|
||||
@@ -70,6 +70,10 @@ if !exists('g:tagbar_autoshowtag')
|
||||
let g:tagbar_autoshowtag = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_updateonsave_maxlines')
|
||||
let g:tagbar_updateonsave_maxlines = 5000
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_systemenc')
|
||||
let g:tagbar_systemenc = &encoding
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user