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