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:
parent
57bbe050c7
commit
2390022e33
@ -12,8 +12,8 @@ if exists('*wordcount')
|
|||||||
else " Pull wordcount from the g_ctrl-g stats
|
else " Pull wordcount from the g_ctrl-g stats
|
||||||
function! s:get_wordcount(visual_mode_active)
|
function! s:get_wordcount(visual_mode_active)
|
||||||
let pattern = a:visual_mode_active
|
let pattern = a:visual_mode_active
|
||||||
\ ? 'Lines; \zs\d\+\ze of \d\+ Words;'
|
\ ? '^.\D*\d\+\D\+\d\+\D\+\zs\d\+'
|
||||||
\ : 'Word \d\+ of \zs\d\+'
|
\ : '^.\D*\%(\d\+\D\+\)\{5}\zs\d\+'
|
||||||
|
|
||||||
let save_status = v:statusmsg
|
let save_status = v:statusmsg
|
||||||
if !a:visual_mode_active && col('.') == col('$')
|
if !a:visual_mode_active && col('.') == col('$')
|
||||||
|
Loading…
Reference in New Issue
Block a user