mirror of
https://github.com/preservim/tagbar.git
synced 2025-02-12 21:21:45 +08:00
Allow configuring zoom, closes #189
This commit is contained in:
parent
836a39af8f
commit
42ce2919a3
|
@ -1929,12 +1929,21 @@ endfunction
|
|||
" s:ZoomWindow() {{{2
|
||||
function! s:ZoomWindow() abort
|
||||
if s:is_maximized
|
||||
execute 'vert resize ' . g:tagbar_width
|
||||
execute 'vertical resize ' . g:tagbar_width
|
||||
execute s:winrestcmd
|
||||
let s:is_maximized = 0
|
||||
else
|
||||
let s:winrestcmd = winrestcmd()
|
||||
vert resize
|
||||
if g:tagbar_zoomwidth == 1
|
||||
vertical resize
|
||||
elseif g:tagbar_zoomwidth == 0
|
||||
let func = exists('*strdisplaywidth') ? 'strdisplaywidth' : 'strlen'
|
||||
let maxline = max(map(getline(line('w0'), line('w$')),
|
||||
\ func . '(v:val)'))
|
||||
execute 'vertical resize ' . maxline
|
||||
elseif g:tagbar_zoomwidth > 1
|
||||
execute 'vertical resize ' . g:tagbar_zoomwidth
|
||||
endif
|
||||
let s:is_maximized = 1
|
||||
endif
|
||||
endfunction
|
||||
|
|
|
@ -398,6 +398,22 @@ Example:
|
|||
let g:tagbar_width = 30
|
||||
<
|
||||
|
||||
*g:tagbar_zoomwidth*
|
||||
g:tagbar_zoomwidth~
|
||||
Default: 1
|
||||
|
||||
Width of the Tagbar window when zoomed.
|
||||
|
||||
Possible values are:
|
||||
1: Use the maximum width available.
|
||||
0: Use the width of the longest currently visible tag.
|
||||
>1: Use this width in characters.
|
||||
|
||||
Example:
|
||||
>
|
||||
let g:tagbar_zoomwidth = 0
|
||||
<
|
||||
|
||||
*g:tagbar_autoclose*
|
||||
g:tagbar_autoclose~
|
||||
Default: 0
|
||||
|
|
|
@ -65,6 +65,7 @@ let s:options = [
|
|||
\ ['sort', 1],
|
||||
\ ['systemenc', &encoding],
|
||||
\ ['width', 40],
|
||||
\ ['zoomwidth', 1],
|
||||
\ ]
|
||||
|
||||
for [opt, val] in s:options
|
||||
|
|
Loading…
Reference in New Issue
Block a user