extensions: show loaded extension once (at most once)

could happen, that extensions are shown several times, if airline is
available in your &rtp several times (for whatever reason)
This commit is contained in:
Christian Brabandt 2019-05-03 12:43:21 +02:00
parent cd2884abf1
commit ea7f5d5313
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 11 additions and 4 deletions

View File

@ -223,15 +223,22 @@ function! s:airline_extensions()
let loaded = airline#extensions#get_loaded_extensions()
let files = split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n")
call map(files, 'fnamemodify(v:val, ":t:r")')
if !empty(files)
echohl Title
echo printf("%-15s\t%s\t%s", "Extension", "Extern", "Status")
echohl Normal
if empty(files)
echo "No extensions loaded"
return
endif
echohl Title
echo printf("%-15s\t%s\t%s", "Extension", "Extern", "Status")
echohl Normal
let set=[]
for ext in sort(files)
if index(set, ext) > -1
continue
endif
let indx=match(loaded, '^'.ext.'\*\?$')
let external = (indx > -1 && loaded[indx] =~ '\*$')
echo printf("%-15s\t%s\t%sloaded", ext, external, indx == -1 ? 'not ' : '')
call add(set, ext)
endfor
endfunction