mirror of
https://github.com/preservim/tagbar.git
synced 2024-11-23 10:41:49 +08:00
Pause autocmd functionality with :TagbarPause
tagbar#PauseAutocommands :TagbarPause :TagbarPause pauses autocmds, effectively freezing Tagbar on the last file. Useful for keeping a tag reference for a file open whilst working in a different file.
This commit is contained in:
parent
2fee7677d5
commit
19695b87b0
|
@ -45,6 +45,7 @@ let s:icon_open = g:tagbar_iconchars[1]
|
|||
|
||||
let s:type_init_done = 0
|
||||
let s:autocommands_done = 0
|
||||
let s:autocommands_enable = 0
|
||||
" 0: not checked yet; 1: checked and found; 2: checked and not found
|
||||
let s:checked_ctags = 0
|
||||
let s:checked_ctags_types = 0
|
||||
|
@ -971,6 +972,19 @@ function! s:CreateAutocommands() abort
|
|||
augroup END
|
||||
|
||||
let s:autocommands_done = 1
|
||||
let s:autocommands_enable = 1
|
||||
endfunction
|
||||
|
||||
" s:PauseAutocommands() {{{2
|
||||
" Toggle autocommands
|
||||
function! s:PauseAutocommands() abort
|
||||
if s:autocommands_enable == 1
|
||||
autocmd! TagbarAutoCmds
|
||||
let s:autocommands_enable = 0
|
||||
else
|
||||
call s:CreateAutocommands()
|
||||
call s:AutoUpdate(fnamemodify(expand('%'), ':p'), 0)
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" s:CheckForExCtags() {{{2
|
||||
|
@ -3456,6 +3470,11 @@ endfunction
|
|||
function! tagbar#RestoreSession() abort
|
||||
call s:RestoreSession()
|
||||
endfunction
|
||||
|
||||
function! tagbar#PauseAutocommands() abort
|
||||
call s:PauseAutocommands()
|
||||
endfunction
|
||||
|
||||
" }}}2
|
||||
|
||||
" tagbar#getusertypes() {{{2
|
||||
|
|
|
@ -111,6 +111,7 @@ command! -nargs=? TagbarCurrentTag echo tagbar#currenttag('%s', 'No current t
|
|||
command! -nargs=1 TagbarGetTypeConfig call tagbar#gettypeconfig(<f-args>)
|
||||
command! -nargs=? TagbarDebug call tagbar#StartDebug(<f-args>)
|
||||
command! -nargs=0 TagbarDebugEnd call tagbar#StopDebug()
|
||||
command! -nargs=0 TagbarPause call tagbar#PauseAutocommands()
|
||||
|
||||
" Modeline {{{1
|
||||
" vim: ts=8 sw=4 sts=4 et foldenable foldmethod=marker foldcolumn=1
|
||||
|
|
Loading…
Reference in New Issue
Block a user