diff --git a/autoload/airline/extensions/wordcount.vim b/autoload/airline/extensions/wordcount.vim index a3b10ed..4227769 100644 --- a/autoload/airline/extensions/wordcount.vim +++ b/autoload/airline/extensions/wordcount.vim @@ -3,12 +3,13 @@ scriptencoding utf-8 -let s:filetypes = get(g:, 'airline#extensions#wordcount#filetypes', '\vhelp|markdown|rst|org|text|asciidoc|tex|mail') let s:format = get(g:, 'airline#extensions#wordcount#format', '%d words') let s:formatter = get(g:, 'airline#extensions#wordcount#formatter', 'default') +let g:airline#extensions#wordcount#filetypes = get(g:, 'airline#extensions#wordcount#filetypes', + \ '\vhelp|markdown|rst|org|text|asciidoc|tex|mail') function! s:update() - if match(&ft, s:filetypes) > -1 + if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1 let l:mode = mode() if l:mode ==# 'v' || l:mode ==# 'V' || l:mode ==# 's' || l:mode ==# 'S' let b:airline_wordcount = airline#extensions#wordcount#formatters#{s:formatter}#format() @@ -27,7 +28,7 @@ function! s:update() endfunction function! airline#extensions#wordcount#apply(...) - if &ft =~ s:filetypes + if match(&ft, get(g:, 'airline#extensions#wordcount#filetypes')) > -1 call airline#extensions#prepend_to_section('z', '%{get(b:, "airline_wordcount", "")}') endif endfunction