mirror of
https://github.com/gryf/tagbar.git
synced 2026-05-10 16:32:58 +02:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91deffb04d | |||
| 9ae8cfedd8 | |||
| a18be73b63 |
+16
-1
@@ -3,7 +3,7 @@
|
||||
Author: Jan Larres <jan@majutsushi.net>
|
||||
Licence: Vim licence, see |license|
|
||||
Homepage: http://majutsushi.github.com/tagbar/
|
||||
Version: 1.0
|
||||
Version: 1.1
|
||||
|
||||
==============================================================================
|
||||
Contents *tagbar* *tagbar-contents*
|
||||
@@ -304,6 +304,18 @@ Example:
|
||||
>
|
||||
let g:tagbar_compact = 1
|
||||
<
|
||||
|
||||
*g:tagbar_expand*
|
||||
g:tagbar_expand~
|
||||
If this option is set the Vim window will be expanded by the width of the
|
||||
Tagbar window if using a GUI version of Vim. The default is not to expand the
|
||||
window.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_expand = 1
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
6. Extending Tagbar *tagbar-extend*
|
||||
|
||||
@@ -607,3 +619,6 @@ anything else that's free, taglist.vim is provided *as is* and comes with no
|
||||
warranty of any kind, either expressed or implied. In no event will the
|
||||
copyright holder be liable for any damamges resulting from the use of this
|
||||
software.
|
||||
|
||||
==============================================================================
|
||||
vim: tw=78 ts=8 sw=8 sts=8 noet ft=help
|
||||
|
||||
+29
-16
@@ -4,7 +4,7 @@
|
||||
" Author: Jan Larres <jan@majutsushi.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 1.0
|
||||
" Version: 1.1
|
||||
" Note: This plugin was heavily inspired by the 'Taglist' plugin by
|
||||
" Yegappan Lakshmanan and uses a small amount of code from it.
|
||||
"
|
||||
@@ -62,9 +62,14 @@ if !exists('g:tagbar_compact')
|
||||
let g:tagbar_compact = 0
|
||||
endif
|
||||
|
||||
if !exists('g:tagbar_expand')
|
||||
let g:tagbar_expand = 0
|
||||
endif
|
||||
|
||||
let s:type_init_done = 0
|
||||
let s:key_mapping_done = 0
|
||||
let s:autocommands_done = 0
|
||||
let s:window_expanded = 0
|
||||
|
||||
" s:InitTypes() {{{2
|
||||
function! s:InitTypes()
|
||||
@@ -837,6 +842,12 @@ function! s:OpenWindow(autoclose)
|
||||
return
|
||||
endif
|
||||
|
||||
" Expand the Vim window to accomodate for the Tagbar window if requested
|
||||
if g:tagbar_expand && !s:window_expanded && has('gui_running')
|
||||
let &columns += g:tagbar_width + 1
|
||||
let s:window_expanded = 1
|
||||
endif
|
||||
|
||||
let openpos = g:tagbar_left ? 'topleft vertical ' : 'botright vertical '
|
||||
exe 'silent! keepalt ' . openpos . g:tagbar_width . 'split ' . '__Tagbar__'
|
||||
|
||||
@@ -880,21 +891,6 @@ function! s:OpenWindow(autoclose)
|
||||
|
||||
let w:autoclose = a:autoclose
|
||||
|
||||
syntax match Comment '^" .*' " Comments
|
||||
syntax match Identifier '^ [^: ]\+[^:]\+$' " Non-scoped kinds
|
||||
syntax match Title '[^(* ]\+\ze\*\? :' " Scope names
|
||||
syntax match Type ' : \zs.*' " Scope types
|
||||
syntax match SpecialKey '(.*)' " Signatures
|
||||
syntax match NonText '\*\ze :' " Pseudo-tag identifiers
|
||||
|
||||
highlight default TagbarAccessPublic guifg=Green ctermfg=Green
|
||||
highlight default TagbarAccessProtected guifg=Blue ctermfg=Blue
|
||||
highlight default TagbarAccessPrivate guifg=Red ctermfg=Red
|
||||
|
||||
syntax match TagbarAccessPublic '^\s*+\ze[^ ]'
|
||||
syntax match TagbarAccessProtected '^\s*#\ze[^ ]'
|
||||
syntax match TagbarAccessPrivate '^\s*-\ze[^ ]'
|
||||
|
||||
if has('balloon_eval')
|
||||
setlocal balloonexpr=TagbarBalloonExpr()
|
||||
set ballooneval
|
||||
@@ -930,6 +926,8 @@ function! s:CloseWindow()
|
||||
return
|
||||
endif
|
||||
|
||||
let tagbarbufnr = winbufnr(tagbarwinnr)
|
||||
|
||||
if winnr() == tagbarwinnr
|
||||
if winbufnr(2) != -1
|
||||
" Other windows are open, only close the tagbar one
|
||||
@@ -948,6 +946,20 @@ function! s:CloseWindow()
|
||||
exe winnum . 'wincmd w'
|
||||
endif
|
||||
endif
|
||||
|
||||
" If the Vim window has been expanded, and Tagbar is not open in any other
|
||||
" tabpages, shrink the window again
|
||||
if s:window_expanded
|
||||
let tablist = []
|
||||
for i in range(tabpagenr('$'))
|
||||
call extend(tablist, tabpagebuflist(i + 1))
|
||||
endfor
|
||||
|
||||
if index(tablist, tagbarbufnr) == -1
|
||||
let &columns -= g:tagbar_width + 1
|
||||
let s:window_expanded = 0
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" s:ZoomWindow() {{{2
|
||||
@@ -1676,6 +1688,7 @@ endfunction
|
||||
" s:CleanUp() {{{2
|
||||
function! s:CleanUp()
|
||||
silent! autocmd! TagbarAutoCmds
|
||||
|
||||
unlet s:current_file
|
||||
unlet s:is_maximized
|
||||
unlet s:compare_typeinfo
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
" File: tagbar.vim
|
||||
" Description: Tagbar syntax settings
|
||||
" Author: Jan Larres <jan@majutsushi.net>
|
||||
" Licence: Vim licence
|
||||
" Website: http://majutsushi.github.com/tagbar/
|
||||
" Version: 1.1
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syntax match Comment '^" .*' " Comments
|
||||
syntax match Identifier '^ [^: ]\+[^:]\+$' " Non-scoped kinds
|
||||
syntax match Title '[^(* ]\+\ze\*\? :' " Scope names
|
||||
syntax match Type ' : \zs.*' " Scope types
|
||||
syntax match SpecialKey '(.*)' " Signatures
|
||||
syntax match NonText '\*\ze :' " Pseudo-tag identifiers
|
||||
|
||||
highlight default TagbarAccessPublic guifg=Green ctermfg=Green
|
||||
highlight default TagbarAccessProtected guifg=Blue ctermfg=Blue
|
||||
highlight default TagbarAccessPrivate guifg=Red ctermfg=Red
|
||||
|
||||
syntax match TagbarAccessPublic '^\s*+\ze[^ ]'
|
||||
syntax match TagbarAccessProtected '^\s*#\ze[^ ]'
|
||||
syntax match TagbarAccessPrivate '^\s*-\ze[^ ]'
|
||||
|
||||
let b:current_syntax = "tagbar"
|
||||
Reference in New Issue
Block a user