wordcount: expose filetype list to global scope
allows better configuration of filetypes to be wordcounted. fixes #1887
This commit is contained in:
parent
b84e548522
commit
45205aa4a3
@ -82,13 +82,14 @@ endfunction
|
|||||||
|
|
||||||
" airline functions {{{1
|
" airline functions {{{1
|
||||||
" default filetypes:
|
" default filetypes:
|
||||||
let s:filetypes = ['help', 'markdown', 'rst', 'org', 'text', 'asciidoc', 'tex', 'mail']
|
|
||||||
function! airline#extensions#wordcount#apply(...)
|
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
|
" Check if filetype needs testing
|
||||||
if did_filetype() || filetypes isnot s:filetypes
|
if did_filetype()
|
||||||
let s:filetypes = filetypes
|
|
||||||
|
|
||||||
" Select test based on type of "filetypes": new=list, old=string
|
" Select test based on type of "filetypes": new=list, old=string
|
||||||
if type(filetypes) == get(v:, 't_list', type([]))
|
if type(filetypes) == get(v:, 't_list', type([]))
|
||||||
|
@ -1180,9 +1180,9 @@ vim-windowswap <https://github.com/wesQ3/vim-windowswap>
|
|||||||
<
|
<
|
||||||
* set list of filetypes for which word counting is enabled: >
|
* set list of filetypes for which word counting is enabled: >
|
||||||
" The default value matches filetypes typically used for documentation
|
" The default value matches filetypes typically used for documentation
|
||||||
" such as markdown and help files.
|
" such as markdown and help files. Default is:
|
||||||
let g:airline#extensions#wordcount#filetypes =
|
let g:airline#extensions#wordcount#filetypes =
|
||||||
\ ['help', 'markdown', 'rst', 'org', 'text', 'asciidoc', 'tex', 'mail']
|
\ ['asciidoc', 'help', 'mail', 'markdown', 'org', 'rst', 'tex', 'text'])
|
||||||
" Use ['all'] to enable for all filetypes.
|
" Use ['all'] to enable for all filetypes.
|
||||||
|
|
||||||
* defines the name of a formatter for word count will be displayed: >
|
* defines the name of a formatter for word count will be displayed: >
|
||||||
|
Loading…
Reference in New Issue
Block a user