mirror of
https://github.com/preservim/tagbar.git
synced 2024-11-22 14:27:01 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
8afd6797e8
|
@ -266,6 +266,7 @@ function! s:InitTypes() abort
|
|||
\ {'short' : 'd', 'long' : 'extends', 'fold' : 0, 'stl' : 0},
|
||||
\ {'short' : 'w', 'long' : 'with', 'fold' : 0, 'stl' : 0},
|
||||
\ {'short' : 'z', 'long' : 'implements', 'fold' : 0, 'stl' : 0},
|
||||
\ {'short' : 'n', 'long' : 'on', 'fold' : 0, 'stl' : 0},
|
||||
\ {'short' : 'r', 'long' : 'constructors', 'fold' : 0, 'stl' : 0},
|
||||
\ {'short' : 'a', 'long' : 'abstract functions', 'fold' : 0, 'stl' : 0},
|
||||
\ {'short' : 'f', 'long' : 'fields', 'fold' : 0, 'stl' : 0},
|
||||
|
@ -882,7 +883,7 @@ function! s:OpenWindow(flags) abort
|
|||
if tagbarwinnr != -1
|
||||
if winnr() != tagbarwinnr && jump
|
||||
call s:goto_win(tagbarwinnr)
|
||||
call s:HighlightTag(g:tagbar_autoshowtag != 2, 1, curline)
|
||||
call s:HighlightTag(g:tagbar_autoshowtag != 2, 1, 1, curline)
|
||||
endif
|
||||
call tagbar#debug#log('OpenWindow finished, Tagbar already open')
|
||||
return
|
||||
|
@ -948,7 +949,7 @@ function! s:OpenWindow(flags) abort
|
|||
endif
|
||||
|
||||
call s:AutoUpdate(curfile, 0)
|
||||
call s:HighlightTag(g:tagbar_autoshowtag != 2, 1, curline)
|
||||
call s:HighlightTag(g:tagbar_autoshowtag != 2, 1, 1, curline)
|
||||
|
||||
if !(g:tagbar_autoclose || autofocus || g:tagbar_autofocus)
|
||||
if exists('*win_getid')
|
||||
|
@ -2251,12 +2252,14 @@ function! s:HighlightTag(openfolds, ...) abort
|
|||
return
|
||||
endif
|
||||
|
||||
let noauto = a:0 > 0 ? a:1 : 0
|
||||
|
||||
let tagline = 0
|
||||
|
||||
let force = a:0 > 0 ? a:1 : 0
|
||||
let force = a:0 > 1 ? a:2 : 0
|
||||
|
||||
if a:0 > 1
|
||||
let tag = s:GetNearbyTag(g:tagbar_highlight_method, 0, a:2)
|
||||
if a:0 > 2
|
||||
let tag = s:GetNearbyTag(g:tagbar_highlight_method, 0, a:3)
|
||||
else
|
||||
let tag = s:GetNearbyTag(g:tagbar_highlight_method, 0)
|
||||
endif
|
||||
|
@ -2334,7 +2337,7 @@ function! s:HighlightTag(openfolds, ...) abort
|
|||
finally
|
||||
if !in_tagbar
|
||||
call s:goto_win(pprevwinnr, 1)
|
||||
call s:goto_win(prevwinnr, 1)
|
||||
call s:goto_win(prevwinnr, noauto)
|
||||
endif
|
||||
redraw
|
||||
endtry
|
||||
|
@ -2460,7 +2463,7 @@ function! s:JumpToTag(stay_in_tagbar, ...) abort
|
|||
normal! zv
|
||||
|
||||
if a:stay_in_tagbar
|
||||
call s:HighlightTag(0)
|
||||
call s:HighlightTag(0, 1)
|
||||
call s:goto_win(tagbarwinnr)
|
||||
redraw
|
||||
elseif g:tagbar_autoclose || autoclose
|
||||
|
@ -2932,7 +2935,7 @@ function! s:AutoUpdate(fname, force, ...) abort
|
|||
let s:nearby_disabled = 0
|
||||
endif
|
||||
|
||||
call s:HighlightTag(0)
|
||||
call s:HighlightTag(0, 1)
|
||||
call s:SetStatusLine()
|
||||
call tagbar#debug#log('AutoUpdate finished successfully')
|
||||
endfunction
|
||||
|
@ -3515,7 +3518,15 @@ function! s:HandleOnlyWindow() abort
|
|||
let vim_quitting = s:vim_quitting
|
||||
let s:vim_quitting = 0
|
||||
|
||||
if vim_quitting && !s:HasOpenFileWindows()
|
||||
let file_open = s:HasOpenFileWindows()
|
||||
|
||||
if vim_quitting && file_open == 2 && !g:tagbar_autoclose_netrw
|
||||
call tagbar#debug#log('Closing Tagbar due to QuitPre - netrw only remaining window')
|
||||
call s:CloseWindow()
|
||||
return
|
||||
endif
|
||||
|
||||
if vim_quitting && file_open != 1
|
||||
call tagbar#debug#log('Closing Tagbar window due to QuitPre event')
|
||||
if winnr('$') >= 1
|
||||
call s:goto_win(tagbarwinnr, 1)
|
||||
|
@ -3633,11 +3644,22 @@ endfunction
|
|||
|
||||
" s:HasOpenFileWindows() {{{2
|
||||
function! s:HasOpenFileWindows() abort
|
||||
let netrw = 0
|
||||
|
||||
for i in range(1, winnr('$'))
|
||||
let buf = winbufnr(i)
|
||||
|
||||
" skip unlisted buffers, except for netrw
|
||||
if !buflisted(buf) && getbufvar(buf, '&filetype') !=# 'netrw'
|
||||
" If the buffer filetype is netrw (or nerdtree) then mark netrw
|
||||
" for final return. If we don't find any other window, we want
|
||||
" to leave the netrw window open and not close vim entirely when
|
||||
" called from the HandleOnlyWindow() code path.
|
||||
let buf_ft = getbufvar(buf, '&filetype')
|
||||
if buf_ft ==# 'netrw' || buf_ft ==# 'nerdtree'
|
||||
let netrw = 1
|
||||
endif
|
||||
|
||||
" skip unlisted buffers
|
||||
if !buflisted(buf)
|
||||
continue
|
||||
endif
|
||||
|
||||
|
@ -3654,6 +3676,10 @@ function! s:HasOpenFileWindows() abort
|
|||
return 1
|
||||
endfor
|
||||
|
||||
if netrw
|
||||
call tagbar#debug#log('netrw only window remaining')
|
||||
return 2
|
||||
endif
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
|
@ -3791,7 +3817,7 @@ function! tagbar#highlighttag(openfolds, force) abort
|
|||
echohl None
|
||||
return
|
||||
endif
|
||||
call s:HighlightTag(a:openfolds, a:force)
|
||||
call s:HighlightTag(a:openfolds, 1, a:force)
|
||||
endfunction
|
||||
|
||||
function! tagbar#RestoreSession() abort
|
||||
|
|
|
@ -713,6 +713,7 @@ function! tagbar#types#uctags#init(supported_types) abort
|
|||
let type_markdown.sro = '""'
|
||||
let type_markdown.sort = 0
|
||||
let types.markdown = type_markdown
|
||||
let types.pandoc = type_markdown
|
||||
" Matlab {{{1
|
||||
let type_matlab = tagbar#prototypes#typeinfo#new()
|
||||
let type_matlab.ctagstype = 'matlab'
|
||||
|
@ -983,7 +984,8 @@ function! tagbar#types#uctags#init(supported_types) abort
|
|||
\ {'short' : 'M', 'long' : 'macro', 'fold' : 0, 'stl' : 1},
|
||||
\ {'short' : 'm', 'long' : 'struct field', 'fold' : 0, 'stl' : 1},
|
||||
\ {'short' : 'e', 'long' : 'enum variant', 'fold' : 0, 'stl' : 1},
|
||||
\ {'short' : 'P', 'long' : 'method', 'fold' : 0, 'stl' : 1}
|
||||
\ {'short' : 'P', 'long' : 'method', 'fold' : 0, 'stl' : 1},
|
||||
\ {'short' : 'C', 'long' : 'constant', 'fold' : 0, 'stl' : 0},
|
||||
\ ]
|
||||
let type_rust.sro = '::'
|
||||
let type_rust.kind2scope = {
|
||||
|
|
|
@ -660,6 +660,23 @@ Example:
|
|||
let g:tagbar_autoclose = 1
|
||||
<
|
||||
|
||||
*g:tagbar_autoclose_netrw*
|
||||
g:tagbar_autoclose_netrw~
|
||||
Default: 0
|
||||
|
||||
This option is used to control the behavior when tagbar is the last window
|
||||
open, but the netrw (or nerdtree) window is also open. If this value is set to
|
||||
1, that will indicate that vim should be closed if tagbar and netrw are the
|
||||
last windows open. If you set this to 0 and tagbar and the netrw (or nerdtree)
|
||||
windows are the only remaining windows, then it will still close the tagbar
|
||||
window, however it will leave vim open with the netrw (or nerdtree) window
|
||||
open.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_autoclose_netrw = 1
|
||||
<
|
||||
|
||||
*g:tagbar_autofocus*
|
||||
g:tagbar_autofocus~
|
||||
Default: 0
|
||||
|
@ -1464,7 +1481,7 @@ IGNORING SPECIFIC FILES *tagbar-ignore*
|
|||
You can ignore specific files by setting the |buffer-variable|
|
||||
"b:tagbar_ignore" to 1. This is best done with an |autocommand|:
|
||||
>
|
||||
autocmd BufNewFile,BufReadPost foo.cpp let b:tagbar_ignore = 1
|
||||
autocmd BufNewFile,BufReadPre foo.cpp let b:tagbar_ignore = 1
|
||||
<
|
||||
Note that autocommands are order-sensitive, so make sure that this autocommand
|
||||
gets defined before the ones that Tagbar defines so the variable will get
|
||||
|
|
|
@ -85,6 +85,7 @@ function! s:setup_options() abort
|
|||
endif
|
||||
let options = [
|
||||
\ ['autoclose', 0],
|
||||
\ ['autoclose_netrw', 0],
|
||||
\ ['autofocus', 0],
|
||||
\ ['autopreview', 0],
|
||||
\ ['autoshowtag', 0],
|
||||
|
|
Loading…
Reference in New Issue
Block a user