From 1c498d1af32bf92eb034f73d814b4e905d7d43b8 Mon Sep 17 00:00:00 2001 From: somini Date: Tue, 10 Nov 2015 20:11:20 +0000 Subject: [PATCH 1/2] Add format to the wordcount plugin --- autoload/airline/extensions/wordcount.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/wordcount.vim b/autoload/airline/extensions/wordcount.vim index 8b7d277..e36c7da 100644 --- a/autoload/airline/extensions/wordcount.vim +++ b/autoload/airline/extensions/wordcount.vim @@ -2,6 +2,7 @@ " vim: et ts=2 sts=2 sw=2 let s:filetypes = get(g:, 'airline#extensions#wordcount#filetypes', '\vhelp|markdown|rst|org') +let s:format = get(g:, 'airline#extensions#wordcount#format', '%d words') " adapted from http://stackoverflow.com/questions/114431/fast-word-count-function-in-vim function! s:update() @@ -21,7 +22,7 @@ function! s:update() if len(parts) > 11 let cnt = str2nr(split(stat)[11]) let spc = g:airline_symbols.space - let b:airline_wordcount = cnt . spc . 'words' . spc . g:airline_right_alt_sep . spc + let b:airline_wordcount = printf(s:format, cnt) . spc . g:airline_right_alt_sep . spc else unlet! b:airline_wordcount endif From e0841b10a7ee2ba59f57447e37e1624e854a7fea Mon Sep 17 00:00:00 2001 From: somini Date: Tue, 10 Nov 2015 20:20:53 +0000 Subject: [PATCH 2/2] Don't update the word count on select mode Fixes #868 --- autoload/airline/extensions/wordcount.vim | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autoload/airline/extensions/wordcount.vim b/autoload/airline/extensions/wordcount.vim index e36c7da..e646232 100644 --- a/autoload/airline/extensions/wordcount.vim +++ b/autoload/airline/extensions/wordcount.vim @@ -9,6 +9,9 @@ function! s:update() if &ft !~ s:filetypes unlet! b:airline_wordcount return + elseif mode() =~? 's' + " Bail on select mode + return endif let old_status = v:statusmsg