Extensions: indicate, if an extension is external

Show in :AirlineExtensions if the extension comes bundled with airline
or from an external source.

closes #1890
This commit is contained in:
Christian Brabandt 2019-03-26 08:41:36 +01:00
parent 1fb184305b
commit a6fb6d9da0
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
3 changed files with 7 additions and 2 deletions

View File

@ -377,6 +377,8 @@ function! airline#extensions#load()
endif endif
try try
call airline#extensions#{name}#init(s:ext) call airline#extensions#{name}#init(s:ext)
" mark as external
call add(s:loaded_ext, name.'*')
catch catch
endtry endtry
endif endif

View File

@ -261,6 +261,7 @@ COMMANDS *airline-commands*
:AirlineExtensions *:AirlineExtensions* :AirlineExtensions *:AirlineExtensions*
Shows the status of all available airline extensions. Shows the status of all available airline extensions.
Extern means, the extensions does not come bundled with Airline.
============================================================================== ==============================================================================
AUTOCOMMANDS *airline-autocommands* AUTOCOMMANDS *airline-autocommands*

View File

@ -205,11 +205,13 @@ function! s:airline_extensions()
call map(files, 'fnamemodify(v:val, ":t:r")') call map(files, 'fnamemodify(v:val, ":t:r")')
if !empty(files) if !empty(files)
echohl Title echohl Title
echo printf("%-15s\t%s", "Extension", "Status") echo printf("%-15s\t%s\t%s", "Extension", "Extern", "Status")
echohl Normal echohl Normal
endif endif
for ext in sort(files) for ext in sort(files)
echo printf("%-15s\t%sloaded", ext, (index(loaded, ext) == -1 ? 'not ' : '')) let indx=match(loaded, '^'.ext.'\*\?$')
let external = (indx > -1 && loaded[indx] =~ '\*$')
echo printf("%-15s\t%s\t%sloaded", ext, external, indx == -1 ? 'not ' : '')
endfor endfor
endfunction endfunction