wordcount: expose filetype list to global scope

allows better configuration of filetypes to be wordcounted.

fixes #1887
This commit is contained in:
Christian Brabandt
2019-03-19 08:28:51 +01:00
parent b84e548522
commit 45205aa4a3
2 changed files with 7 additions and 6 deletions

View File

@@ -82,13 +82,14 @@ endfunction
" airline functions {{{1
" default filetypes:
let s:filetypes = ['help', 'markdown', 'rst', 'org', 'text', 'asciidoc', 'tex', 'mail']
function! airline#extensions#wordcount#apply(...)
let filetypes = get(g:, 'airline#extensions#wordcount#filetypes', s:filetypes)
let filetypes = get(g:, 'airline#extensions#wordcount#filetypes',
\ ['asciidoc', 'help', 'mail', 'markdown', 'org', 'rst', 'tex', 'text'])
" export current filetypes settings to global namespace
let g:airline#extensions#wordcount#filetypes = filetypes
" Check if filetype needs testing
if did_filetype() || filetypes isnot s:filetypes
let s:filetypes = filetypes
if did_filetype()
" Select test based on type of "filetypes": new=list, old=string
if type(filetypes) == get(v:, 't_list', type([]))