Small wordcount format output on windows < 80

This commit is contained in:
Christian Brabandt 2017-02-24 18:25:29 +01:00
parent 562d060b08
commit b2bbe7dbc2
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
1 changed files with 13 additions and 7 deletions

View File

@ -8,6 +8,8 @@ function! airline#extensions#wordcount#formatters#default#format()
if empty(words)
return
endif
let result = g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space
if winwidth(0) >= 80
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
@ -15,7 +17,11 @@ function! airline#extensions#wordcount#formatters#default#format()
let a = substitute(a, '...', '&'.separator, 'g')
let words = join(reverse(split(a, '.\zs')),'')
endif
return words . " words" . g:airline_symbols.space . g:airline_right_alt_sep . g:airline_symbols.space
let result = printf("%s%s", words, " words"). result
else
let result = printf("%s%s", words, "W"). result
endif
return result
endfunction
function! s:wordcount()