mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 12:24:14 +08:00
taglist: correctly check for right taglist plugin
Avoid the error `Unknown function: taglist#Tlist_Get_Tagname_By_Line`
when using the old tag tlist plugin in a different way.
this means, we have to revert 5841039679
since exists() does not handle autoloaded functions correctly.
We can only check it, after we have used the taglist plugin, so that the
autoloading has happened. That means, move the exists() call after the
`:TListUpdate` call which will correctly autoload taglist and then
exists() can check for the existence of the
`taglist#Tlist_Get_Tagname_By_Line()` function correctly.
closes: #2463
This commit is contained in:
parent
5841039679
commit
ec761c2adf
|
@ -249,9 +249,7 @@ function! airline#extensions#load()
|
|||
call airline#extensions#tagbar#init(s:ext)
|
||||
call add(s:loaded_ext, 'tagbar')
|
||||
endif
|
||||
if get(g:, 'airline#extensions#taglist#enabled', 1)
|
||||
\ && exists(':TlistShowTag')
|
||||
\ && exists('*taglist#Tlist_Get_Tagname_By_Line')
|
||||
if get(g:, 'airline#extensions#taglist#enabled', 1) && exists(':TlistShowTag')
|
||||
call airline#extensions#taglist#init(s:ext)
|
||||
call add(s:loaded_ext, 'taglist')
|
||||
endif
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
scriptencoding utf-8
|
||||
|
||||
if !exists(':TlistShowTag') && !exists('*taglist#Tlist_Get_Tagname_By_Line')
|
||||
if !exists(':TlistShowTag')
|
||||
finish
|
||||
endif
|
||||
|
||||
|
@ -21,7 +21,14 @@ function! airline#extensions#taglist#currenttag()
|
|||
let tlist_updated = v:true
|
||||
endif
|
||||
endif
|
||||
return taglist#Tlist_Get_Tagname_By_Line()
|
||||
" Is this function is not present it'means you use the old vertsion of
|
||||
" tag list : https://github.com/vim-scripts/taglist.vim.
|
||||
" Please use the new version : https://github.com/yegappan/taglist.
|
||||
if exists('*taglist#Tlist_Get_Tagname_By_Line()')
|
||||
return taglist#Tlist_Get_Tagname_By_Line()
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! airline#extensions#taglist#init(ext)
|
||||
|
|
Loading…
Reference in New Issue
Block a user