Some cleanup so it's not too specific to my system
This commit is contained in:
parent
b8cd7ebbfa
commit
fcd5bc5f4a
1 changed files with 11 additions and 11 deletions
22
vimrc
22
vimrc
|
@ -1,19 +1,19 @@
|
||||||
" COMBO Counter
|
" COMBO Counter
|
||||||
let g:combo_counter = 0
|
let g:combo_counter = 0 " The actual combo variable
|
||||||
let g:best_combo = readfile('/home/$USER/.vim/.combo')
|
let g:best_combo = readfile('/home/$USER/.vim/.combo') " ~ is not expanded ???
|
||||||
let g:best_combo = g:best_combo[0]
|
let g:best_combo = g:best_combo[0] " Reading from file returns a list, but an int is needed
|
||||||
let g:last_combo = reltime()
|
let g:last_combo = reltime() " Set current time as last combo time
|
||||||
let g:airline_section_b = 'ᛥ %{g:combo_counter} [%{g:best_combo}]'
|
let g:airline_section_b = 'ᛥ %{g:combo_counter} [%{g:best_combo}]' " I use airline vim and inserted the combo meter in it
|
||||||
function! UpdateCombo()
|
function! UpdateCombo()
|
||||||
if reltimefloat(reltime(g:last_combo)) > 1
|
if reltimefloat(reltime(g:last_combo)) > 1 " Timeout is 1 second
|
||||||
let g:combo_counter = 1
|
if g:combo_counter > g:best_combo " Before resetting combo counter, check if new high score
|
||||||
else
|
|
||||||
let g:combo_counter +=1
|
|
||||||
if g:combo_counter > g:best_combo
|
|
||||||
call writefile([g:combo_counter], "/home/$USER/.vim/.combo")
|
call writefile([g:combo_counter], "/home/$USER/.vim/.combo")
|
||||||
let g:best_combo = g:combo_counter
|
let g:best_combo = g:combo_counter
|
||||||
endif
|
endif
|
||||||
|
let g:combo_counter = 1
|
||||||
|
else
|
||||||
|
let g:combo_counter +=1
|
||||||
endif
|
endif
|
||||||
let g:last_combo = reltime()
|
let g:last_combo = reltime()
|
||||||
endfunction
|
endfunction
|
||||||
autocmd CursorMovedI * call UpdateCombo()
|
autocmd CursorMovedI * call UpdateCombo() " Every time the cursor moves, call combo function
|
||||||
|
|
Loading…
Reference in a new issue