wordcount: move User autocommand to plugin

Do not scatter the autocommands around, but rather move the auto command
to the main plugin file. The function that handles the auto command will
be created in the autoload script.

Also add a call to force updating the tabline, if g:airline_statusline_ontop
is defined.

In addition, the wordcount() extension did not correctly notice
block-wise visual mode, so while creating the airline#mode_changed()
function, make the mode also detect blockwise visual mode correctly.
This commit is contained in:
Christian Brabandt
2019-02-04 08:25:45 +01:00
parent 8867301f78
commit 25e384f236
3 changed files with 10 additions and 6 deletions

View File

@@ -271,3 +271,11 @@ function! airline#update_tabline()
call airline#extensions#tabline#redraw()
endif
endfunction
function! airline#mode_changed()
" airline#visual_active
" Boolean: for when to get visual wordcount
" needed for the wordcount extension
let g:airline#visual_active = (mode() =~? '[vs]')
call airline#update_tabline()
endfunction