wordcount: allow to disable vimtex wordcount()

While Commit e542f5e introduced a nice little feature for TeX files to
accurately count words, this unfortunately has the drawback of being
possibly slow, especially since the statusline is often re-evaluated.

Therefore disable this feature by default. You can enable it using:

    :let g:airline#extensions#vimtex#wordcount = 1

fixes #2461
This commit is contained in:
Christian Brabandt 2021-11-11 22:47:54 +01:00
parent 47bf6b1716
commit 6e5439126f
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 7 additions and 2 deletions

View File

@ -9,7 +9,7 @@ if exists('*wordcount')
if get(g:, 'actual_curbuf', '') != bufnr('')
return
endif
if &filetype ==# 'tex' && exists('b:vimtex')
if &filetype ==# 'tex' && exists('b:vimtex') && get(g:, 'airline#extensions#vimtex#wordcount', 0)
" We're in a TeX file and vimtex is a plugin, so use vimtex's wordcount...
return vimtex#misc#wordcount()
else

View File

@ -1507,6 +1507,11 @@ State indicators:
* viewer is opened >
let g:airline#extensions#vimtex#viewer = "v"
* use vimtex specific wordcount function
for TeX buffers Note: this more accurate
but may slow down Vim) >
let g:airline#extensions#vimtex#wordcount = 1
------------------------------------- *airline-virtualenv*
virtualenv <https://github.com/jmcantrell/vim-virtualenv>