From 2390022e33dc5eac6872a09ec39ee769298e1ef3 Mon Sep 17 00:00:00 2001 From: Liam Fleming Date: Sun, 23 Sep 2018 20:07:09 +0200 Subject: [PATCH] wordcount: do not rely on english in old versions for older Vims, the wordcount extension falls back to `g` and parses the messaage that is generated. When doing so, it expects the English locale, which might not be true. Therefore, try to regex parse the result without using the english words (assuming the output is still in the same order as in English). --- autoload/airline/extensions/wordcount.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions/wordcount.vim b/autoload/airline/extensions/wordcount.vim index 3bac63a..7737cd6 100644 --- a/autoload/airline/extensions/wordcount.vim +++ b/autoload/airline/extensions/wordcount.vim @@ -12,8 +12,8 @@ if exists('*wordcount') else " Pull wordcount from the g_ctrl-g stats function! s:get_wordcount(visual_mode_active) let pattern = a:visual_mode_active - \ ? 'Lines; \zs\d\+\ze of \d\+ Words;' - \ : 'Word \d\+ of \zs\d\+' + \ ? '^.\D*\d\+\D\+\d\+\D\+\zs\d\+' + \ : '^.\D*\%(\d\+\D\+\)\{5}\zs\d\+' let save_status = v:statusmsg if !a:visual_mode_active && col('.') == col('$')