wordcount: only add fmt function once to statusline functions
This prevents a warning message, when the function is tried to add several times. Also while at it, add a '!' so that no error is thrown if the file is sourced a second times.
This commit is contained in:
parent
110594c91a
commit
7957bd1d32
@ -3,14 +3,17 @@
|
||||
|
||||
scriptencoding utf-8
|
||||
|
||||
function s:update_fmt(...)
|
||||
function! s:update_fmt(...)
|
||||
let s:fmt = get(g:, 'airline#extensions#wordcount#formatter#default#fmt', '%s words')
|
||||
let s:fmt_short = get(g:, 'airline#extensions#wordcount#formatter#default#fmt_short', s:fmt == '%s words' ? '%sW' : s:fmt)
|
||||
endfunction
|
||||
|
||||
" Reload format when statusline is rebuilt
|
||||
call s:update_fmt()
|
||||
call airline#add_statusline_funcref(function('s:update_fmt'))
|
||||
if index(g:airline_statusline_funcrefs, function('s:update_fmt')) == -1
|
||||
" only add it, if not already done
|
||||
call airline#add_statusline_funcref(function('s:update_fmt'))
|
||||
endif
|
||||
|
||||
if match(get(v:, 'lang', ''), '\v\cC|en') > -1
|
||||
let s:decimal_group = ','
|
||||
|
Loading…
Reference in New Issue
Block a user