Added combo bar

This commit is contained in:
əlemi 2019-11-02 05:00:46 +01:00
parent 6d5f180e77
commit a2779319fe
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -24,17 +24,26 @@ else
endif endif
" Configure variables " Configure variables
let g:combo_counter = 0 " The actual combo variable let g:combo_counter = 0 " The actual combo variable
let g:timeout = 1 let g:timeout = 1
let g:last_combo = reltime() " Set current time as last combo time let g:emphasis = ''
let g:airline_section_b = 'ᛥ %{g:combo_counter}|%{g:best_combo} [%{g:best_combo_all}]' " I use airline vim and inserted the combo meter in it let g:mult = 10
let g:last_combo = reltime() " Set current time as last combo time
let g:airline_section_b = 'ᛥ %{g:combo_counter}|%{g:best_combo}|%{g:best_combo_all} %{g:emphasis}'
function! UpdateCombo() function! UpdateCombo()
if reltimefloat(reltime(g:last_combo)) > g:timeout " Timeout is 1 second if reltimefloat(reltime(g:last_combo)) > g:timeout
call SaveCombo() call SaveCombo()
let g:combo_counter = 1 let g:combo_counter = 1
else else
let g:combo_counter +=1 let g:combo_counter +=1
endif endif
let g:emphasis = ''
let ceil = g:combo_counter / g:mult
let i = 0
while i < ceil
let g:emphasis = g:emphasis . 'ᛞ'
let i+=1
endwhile
let g:last_combo = reltime() let g:last_combo = reltime()
endfunction endfunction
function! SaveCombo() function! SaveCombo()