mirror of
https://github.com/vim-airline/vim-airline.git
synced 2024-11-22 13:16:03 +08:00
Modifies the wordcount to use the vimtex wordcount function when editing TeX files and the vimtex plugin is loaded.
With help from Karl Lervag's suggestion on how to reliably tell when the above mentioned conditions are the case for the current buffer Checked to work with other filetypes that use the wordcount in vim-airline, and these seem to work as before. Also checked that if two of these filetypes (one TeX and the other another type, such as markdown) the two coexist peacefully, with TeX using Karl's wordcount function, and the other using the (I assume) native wordcount? Fixed comment wording
This commit is contained in:
parent
17f7dff748
commit
e542f5e9d0
|
@ -9,8 +9,13 @@ if exists('*wordcount')
|
|||
if get(g:, 'actual_curbuf', '') != bufnr('')
|
||||
return
|
||||
endif
|
||||
let query = a:visual_mode_active ? 'visual_words' : 'words'
|
||||
return get(wordcount(), query, 0)
|
||||
if &filetype ==# 'tex' && exists('b:vimtex')
|
||||
" 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'
|
||||
return get(wordcount(), query, 0)
|
||||
endif
|
||||
endfunction
|
||||
else " Pull wordcount from the g_ctrl-g stats
|
||||
function! s:get_wordcount(visual_mode_active)
|
||||
|
|
Loading…
Reference in New Issue
Block a user