From ea7f5d53135db890088666bfb6627e7c6b7388e1 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 3 May 2019 12:43:21 +0200 Subject: [PATCH] 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) --- plugin/airline.vim | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugin/airline.vim b/plugin/airline.vim index bf3d841..cca7524 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -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