From 6e5439126f45c13eae271da6ec88637607976aa9 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Thu, 11 Nov 2021 22:47:54 +0100 Subject: [PATCH] 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 --- autoload/airline/extensions/wordcount.vim | 4 ++-- doc/airline.txt | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/autoload/airline/extensions/wordcount.vim b/autoload/airline/extensions/wordcount.vim index a1e32f60..59203068 100644 --- a/autoload/airline/extensions/wordcount.vim +++ b/autoload/airline/extensions/wordcount.vim @@ -9,8 +9,8 @@ if exists('*wordcount') if get(g:, 'actual_curbuf', '') != bufnr('') return endif - if &filetype ==# 'tex' && exists('b:vimtex') -" We're in a TeX file and vimtex is a plugin, so use vimtex's wordcount... + 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 let query = a:visual_mode_active ? 'visual_words' : 'words' diff --git a/doc/airline.txt b/doc/airline.txt index 076e0e33..2459b571 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -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