From fc021cf4e862eb20b92918d8e8a65b8ff8e7a837 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 1 Nov 2018 11:14:57 +0100 Subject: [PATCH] po: only substitute, if value is present in string --- autoload/airline/extensions/po.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/po.vim b/autoload/airline/extensions/po.vim index 48df4f6..c027faa 100644 --- a/autoload/airline/extensions/po.vim +++ b/autoload/airline/extensions/po.vim @@ -18,8 +18,10 @@ function! airline#extensions#po#shorten() let untranslated = '' let messages = '' " Shorten [120 translated, 50 fuzzy, 4 untranslated] to [120T/50F/4U] - if b:airline_po_stats =~ 'untranslated\|fuzzy' + if b:airline_po_stats =~ 'fuzzy' let fuzzy = substitute(b:airline_po_stats, '.*\(\d\+\) fuzzy.*', '\1F', '') + endif + if b:airline_po_stats =~ 'untranslated' let untranslated = substitute(b:airline_po_stats, '.*\(\d\+\) untranslated.*', '\1U', '') endif let messages = substitute(b:airline_po_stats, '\(\d\+\) translated.*', '\1T', '')