wordcount: do not rely on english in old versions

for older Vims, the wordcount extension falls back to `g<c-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).
This commit is contained in:
Liam Fleming
2018-09-23 20:07:09 +02:00
committed by Christian Brabandt
parent 57bbe050c7
commit 2390022e33

View File

@@ -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('$')