Organized the plugin structure. Added initial documentation
This commit is contained in:
parent
fcd5bc5f4a
commit
10fa4901c9
2 changed files with 34 additions and 0 deletions
15
doc/vim-combo.txt
Normal file
15
doc/vim-combo.txt
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
.__ ___.
|
||||||
|
___ _|__| _____ ____ ____ _____\_ |__ ____
|
||||||
|
\ \/ / |/ \ ______ _/ ___\/ _ \ / \| __ \ / _ \
|
||||||
|
\ /| | Y Y \ /_____/ \ \__( <_> ) Y Y \ \_\ ( <_> )
|
||||||
|
\_/ |__|__|_| / \___ >____/|__|_| /___ /\____/
|
||||||
|
\/ \/ \/ \/
|
||||||
|
|
||||||
|
Each keystroke in insert mode increases your combo, but not typing for 1 second resets it.
|
||||||
|
Hacks are not patched around : you can keep a key pressed to increase your combo, and CTRL+SHIFT+V will all be counted as a combo.
|
||||||
|
|
||||||
|
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.
|
||||||
|
If you get errors at launch, check that .combo exists and has just a number inside (should be 0, or last best combo).
|
||||||
|
|
||||||
|
The plugin is still under construction. Right now, you will need to edit the path to the .combo file and choose where to display the combo information.
|
||||||
|
By default, the section B of airline-vim is overwritten to display current combo. A random Runic character has been chosen to indicate the combo field.
|
19
plugin/vim-combo.vim
Normal file
19
plugin/vim-combo.vim
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
" COMBO Counter
|
||||||
|
let g:combo_counter = 0 " The actual combo variable
|
||||||
|
let g:best_combo = readfile('/home/$USER/.vim/.combo') " ~ is not expanded ???
|
||||||
|
let g:best_combo = g:best_combo[0] " Reading from file returns a list, but an int is needed
|
||||||
|
let g:last_combo = reltime() " Set current time as last combo time
|
||||||
|
let g:airline_section_b = 'ᛥ %{g:combo_counter} [%{g:best_combo}]' " I use airline vim and inserted the combo meter in it
|
||||||
|
function! UpdateCombo()
|
||||||
|
if reltimefloat(reltime(g:last_combo)) > 1 " Timeout is 1 second
|
||||||
|
if g:combo_counter > g:best_combo " Before resetting combo counter, check if new high score
|
||||||
|
call writefile([g:combo_counter], "/home/$USER/.vim/.combo")
|
||||||
|
let g:best_combo = g:combo_counter
|
||||||
|
endif
|
||||||
|
let g:combo_counter = 1
|
||||||
|
else
|
||||||
|
let g:combo_counter +=1
|
||||||
|
endif
|
||||||
|
let g:last_combo = reltime()
|
||||||
|
endfunction
|
||||||
|
autocmd CursorMovedI * call UpdateCombo() " Every time the cursor moves, call combo function
|
Loading…
Reference in a new issue