mirror of
https://github.com/preservim/tagbar.git
synced 2025-02-15 14:12:46 +08:00
Simplify getusertypes() function
This commit is contained in:
parent
ec0eb883dc
commit
b6f47e4020
|
@ -3596,21 +3596,15 @@ endfunction
|
|||
|
||||
" tagbar#getusertypes() {{{2
|
||||
function! tagbar#getusertypes() abort
|
||||
redir => defs
|
||||
silent execute 'let g:'
|
||||
redir END
|
||||
let userdefs = filter(copy(g:), 'v:key =~ "^tagbar_type_"')
|
||||
|
||||
let deflist = split(defs, '\n')
|
||||
call map(deflist, 'substitute(v:val, ''^\S\+\zs.*'', "", "")')
|
||||
call filter(deflist, 'v:val =~ "^tagbar_type_"')
|
||||
|
||||
let defdict = {}
|
||||
for defstr in deflist
|
||||
let type = substitute(defstr, '^tagbar_type_', '', '')
|
||||
let defdict[type] = g:{defstr}
|
||||
let typedict = {}
|
||||
for [key, val] in items(userdefs)
|
||||
let type = substitute(key, '^tagbar_type_', '', '')
|
||||
let typedict[type] = val
|
||||
endfor
|
||||
|
||||
return defdict
|
||||
return typedict
|
||||
endfunction
|
||||
|
||||
" tagbar#autoopen() {{{2
|
||||
|
|
Loading…
Reference in New Issue
Block a user