Updated combo tracking method!

This commit is contained in:
əlemi 2019-11-02 00:39:34 +01:00
parent 53aec8b53a
commit b6a5636325
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 2 additions and 15 deletions

View file

@ -11,10 +11,7 @@ _____________\///______\///__\///___\///___\///___________________\////////_____
=========================================================================================================================================== ===========================================================================================================================================
Each keystroke in insert mode increases your combo, Each keystroke in insert mode increases your combo,
but not typing for 1 second resets it. but not typing for 1 second resets it.
Hacks are not patched around : you can keep a key pressed to increase your The script is triggered whenever a text edit is detected in insert mode.
combo, and CTRL+SHIFT+V will all be counted as a combo.
( since afaik vim does not allow to remap all letters to an action combo
counter is increased with every cursor movement )
Best score is displayed next to the current combo in square brackets. Best score is displayed next to the current combo in square brackets.
When a new high score is achieved, it is saved inside .vim as .combo. When a new high score is achieved, it is saved inside .vim as .combo.

View file

@ -28,15 +28,5 @@ else
endif endif
let g:last_combo = reltime() let g:last_combo = reltime()
endfunction endfunction
autocmd CursorMovedI * call UpdateCombo() " Every time the cursor moves, call combo function autocmd TextChangedI * call UpdateCombo() " Every time text in the file changes, call combo function
function! ResetCombo()
let g:combo_counter = 0
call writefile(0, "$HOME/.vim/.combo")
endfunction
" NOT NECESSARY! Only enable if you find yourself cheating by staying in insert mode!
" inoremap <Left> <C-o>:let g:combo_counter=0<CR><Left>
" inoremap <Right> <C-o>:let g:combo_counter=0<CR><Right>
" inoremap <Up> <C-o>:let g:combo_counter=0<CR><Up>
" inoremap <Down> <C-o>:let g:combo_counter=0<CR><Down>
endif endif