From 8c30610c5f60eada1d21ab23e96d45848a1e6e58 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Wed, 7 Oct 2015 20:44:34 -0400 Subject: [PATCH] allow wordcount filetypes to be customized. resolves #864. --- autoload/airline/extensions/wordcount.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/airline/extensions/wordcount.vim b/autoload/airline/extensions/wordcount.vim index 6ea24f3..f212c8c 100644 --- a/autoload/airline/extensions/wordcount.vim +++ b/autoload/airline/extensions/wordcount.vim @@ -1,11 +1,11 @@ " MIT License. Copyright (c) 2013-2015 Bailey Ling. " vim: et ts=2 sts=2 sw=2 -let g:airline#extensions#wordcount#filetypes = '\vhelp|markdown|rst|org' +let s:filetypes = get(g:, 'airline#extensions#wordcount#filetypes', '\vhelp|markdown|rst|org') " adapted from http://stackoverflow.com/questions/114431/fast-word-count-function-in-vim function! s:update() - if &ft !~ g:airline#extensions#wordcount#filetypes + if &ft !~ s:filetypes unlet! b:airline_wordcount return endif @@ -28,7 +28,7 @@ function! s:update() endfunction function! airline#extensions#wordcount#apply(...) - if &ft =~ g:airline#extensions#wordcount#filetypes + if &ft =~ s:filetypes call airline#extensions#prepend_to_section('z', '%{get(b:, "airline_wordcount", "")}') endif endfunction