1
0
mirror of https://github.com/gryf/tagbar.git synced 2025-12-18 12:00:23 +01:00

Move parsing of user type defs into separate function

This commit is contained in:
Jan Larres
2012-03-08 18:06:51 +13:00
parent a9209b4367
commit dd84a57c6e

View File

@@ -805,19 +805,7 @@ function! s:LoadUserTypeDefs(...)
else
call s:LogDebugMessage('Initializing user types')
redir => defs
silent execute 'let g:'
redir END
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}
endfor
let defdict = tagbar#getusertypes()
endif
" Transform the 'kind' definitions into dictionary format
@@ -3267,6 +3255,25 @@ function! tagbar#RestoreSession()
call s:RestoreSession()
endfunction
" tagbar#getusertypes() {{{2
function! tagbar#getusertypes()
redir => defs
silent execute 'let g:'
redir END
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}
endfor
return defdict
endfunction
" Automatically open Tagbar if one of the open buffers contains a supported
" file
function! tagbar#autoopen(...)