mirror of
https://github.com/gryf/tagbar.git
synced 2025-12-17 11:30:28 +01:00
Make SetFoldlevel respect default-closed folds without '!', closes #61
This commit is contained in:
@@ -928,12 +928,12 @@ function! s:MapKeys()
|
||||
nnoremap <script> <silent> <buffer> o :call <SID>ToggleFold()<CR>
|
||||
nnoremap <script> <silent> <buffer> za :call <SID>ToggleFold()<CR>
|
||||
|
||||
nnoremap <script> <silent> <buffer> * :call <SID>SetFoldLevel(99)<CR>
|
||||
nnoremap <script> <silent> <buffer> * :call <SID>SetFoldLevel(99, 1)<CR>
|
||||
nnoremap <script> <silent> <buffer> <kMultiply>
|
||||
\ :call <SID>SetFoldLevel(99)<CR>
|
||||
nnoremap <script> <silent> <buffer> zR :call <SID>SetFoldLevel(99)<CR>
|
||||
nnoremap <script> <silent> <buffer> = :call <SID>SetFoldLevel(0)<CR>
|
||||
nnoremap <script> <silent> <buffer> zM :call <SID>SetFoldLevel(0)<CR>
|
||||
\ :call <SID>SetFoldLevel(99, 1)<CR>
|
||||
nnoremap <script> <silent> <buffer> zR :call <SID>SetFoldLevel(99, 1)<CR>
|
||||
nnoremap <script> <silent> <buffer> = :call <SID>SetFoldLevel(0, 1)<CR>
|
||||
nnoremap <script> <silent> <buffer> zM :call <SID>SetFoldLevel(0, 1)<CR>
|
||||
|
||||
nnoremap <script> <silent> <buffer> <C-N>
|
||||
\ :call <SID>GotoNextToplevelTag(1)<CR>
|
||||
@@ -2805,7 +2805,7 @@ function! s:ToggleFold()
|
||||
endfunction
|
||||
|
||||
" s:SetFoldLevel() {{{2
|
||||
function! s:SetFoldLevel(level)
|
||||
function! s:SetFoldLevel(level, force)
|
||||
if a:level < 0
|
||||
echoerr 'Foldlevel can''t be negative'
|
||||
return
|
||||
@@ -2827,7 +2827,9 @@ function! s:SetFoldLevel(level)
|
||||
endfor
|
||||
else
|
||||
for kind in typeinfo.kinds
|
||||
call fileinfo.openKindFold(kind)
|
||||
if a:force || !kind.fold
|
||||
call fileinfo.openKindFold(kind)
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
@@ -3254,8 +3256,8 @@ function! tagbar#CloseWindow()
|
||||
call s:CloseWindow()
|
||||
endfunction
|
||||
|
||||
function! tagbar#SetFoldLevel(...)
|
||||
call s:SetFoldLevel(a:1)
|
||||
function! tagbar#SetFoldLevel(level, force)
|
||||
call s:SetFoldLevel(a:level, a:force)
|
||||
endfunction
|
||||
|
||||
function! tagbar#OpenParents()
|
||||
|
||||
@@ -252,10 +252,12 @@ COMMANDS *tagbar-commands*
|
||||
Open the Tagbar window, jump to it and close it on tag selection. This is
|
||||
an alias for ":TagbarOpen fc".
|
||||
|
||||
:TagbarSetFoldlevel {number}
|
||||
:TagbarSetFoldlevel[!] {number}
|
||||
Set the foldlevel of the tags of the current file to {number}. The
|
||||
foldlevel of tags in other files remains unaffected. Works in the same way
|
||||
as 'foldlevel'.
|
||||
as 'foldlevel'. Folds that are specified to be closed by default in the
|
||||
type configuration will not be opened, use a "!" to force applying the new
|
||||
foldlevel to those folds as well.
|
||||
|
||||
:TagbarShowTag
|
||||
Open the parent folds of the current tag in the file window as much as
|
||||
|
||||
@@ -109,7 +109,7 @@ command! -nargs=0 TagbarToggle call tagbar#ToggleWindow()
|
||||
command! -nargs=? TagbarOpen call tagbar#OpenWindow(<f-args>)
|
||||
command! -nargs=0 TagbarOpenAutoClose call tagbar#OpenWindow('fc')
|
||||
command! -nargs=0 TagbarClose call tagbar#CloseWindow()
|
||||
command! -nargs=1 TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>)
|
||||
command! -nargs=1 -bang TagbarSetFoldlevel call tagbar#SetFoldLevel(<args>, <bang>0)
|
||||
command! -nargs=0 TagbarShowTag call tagbar#OpenParents()
|
||||
command! -nargs=? TagbarDebug call tagbar#StartDebug(<f-args>)
|
||||
command! -nargs=0 TagbarDebugEnd call tagbar#StopDebug()
|
||||
|
||||
Reference in New Issue
Block a user