From db01efd50861cb9c7ed61a1d39c439a18933b1e6 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Fri, 24 Feb 2017 18:28:48 +0100 Subject: [PATCH] Better reformat wordcount format in with separator --- autoload/airline/extensions/wordcount/formatters/default.vim | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/autoload/airline/extensions/wordcount/formatters/default.vim b/autoload/airline/extensions/wordcount/formatters/default.vim index 9acf074..059d06e 100644 --- a/autoload/airline/extensions/wordcount/formatters/default.vim +++ b/autoload/airline/extensions/wordcount/formatters/default.vim @@ -13,9 +13,7 @@ function! airline#extensions#wordcount#formatters#default#format() let separator = s:get_decimal_group() if words > 999 && !empty(separator) " Format number according to locale, e.g. German: 1.245 or English: 1,245 - let a = join(reverse(split(words, '.\zs')),'') - let a = substitute(a, '...', '&'.separator, 'g') - let words = join(reverse(split(a, '.\zs')),'') + let words = substitute(words, '\d\@<=\(\(\d\{3\}\)\+\)$', separator.'&', 'g') endif let result = printf("%s%s", words, " words"). result else