Better reformat wordcount format in with separator

This commit is contained in:
Christian Brabandt 2017-02-24 18:28:48 +01:00
parent b2bbe7dbc2
commit db01efd508
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 1 additions and 3 deletions

View File

@ -13,9 +13,7 @@ function! airline#extensions#wordcount#formatters#default#format()
let separator = s:get_decimal_group() let separator = s:get_decimal_group()
if words > 999 && !empty(separator) if words > 999 && !empty(separator)
" Format number according to locale, e.g. German: 1.245 or English: 1,245 " Format number according to locale, e.g. German: 1.245 or English: 1,245
let a = join(reverse(split(words, '.\zs')),'') let words = substitute(words, '\d\@<=\(\(\d\{3\}\)\+\)$', separator.'&', 'g')
let a = substitute(a, '...', '&'.separator, 'g')
let words = join(reverse(split(a, '.\zs')),'')
endif endif
let result = printf("%s%s", words, " words"). result let result = printf("%s%s", words, " words"). result
else else