From 3b339fee982b9d10849ce6b4c9e83e4608cb9251 Mon Sep 17 00:00:00 2001 From: "Serge Y. Stroobandt" Date: Thu, 20 Feb 2020 19:20:00 +0100 Subject: [PATCH] wordcount: Word count for the combined file types [Pandoc flavoured Markdown](https://en.wikipedia.org/wiki/Markdown#CommonMark) has its [own file type in `vim`](https://github.com/vim-pandoc/vim-pandoc-syntax#standalone), namely `markdown.pandoc`. Word count by default in `vim-airline` obviously would make a lot of sense for this popular file type. Fix this, by making sure that the wordcount extensions will apply correctly if any of the combined filetypes (e.g. either pandoc or markdwon) matches the list of allowed filetypes. --- autoload/airline/extensions/wordcount.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autoload/airline/extensions/wordcount.vim b/autoload/airline/extensions/wordcount.vim index 7436673d..c25ca78d 100644 --- a/autoload/airline/extensions/wordcount.vim +++ b/autoload/airline/extensions/wordcount.vim @@ -93,10 +93,12 @@ function! airline#extensions#wordcount#apply(...) " Check if filetype needs testing if did_filetype() + " correctly test for compound filetypes (e.g. markdown.pandoc) + let ft = substitute(&filetype, '\.', '\\|', 'g') " Select test based on type of "filetypes": new=list, old=string if type(filetypes) == get(v:, 't_list', type([])) - \ ? index(filetypes, &filetype) > -1 || index(filetypes, 'all') > -1 + \ ? match(filetypes, ft) > -1 || index(filetypes, 'all') > -1 \ : match(&filetype, filetypes) > -1 let b:airline_changedtick = -1 call s:update_wordcount(1) " force update: ensures initial worcount exists