Added ignored files
This commit is contained in:
parent
983b6925af
commit
8e52d7716d
1 changed files with 54 additions and 40 deletions
|
@ -14,47 +14,61 @@ for f in split(globpath($HOME . '/.vim/.combo/', '*'), '\n')
|
||||||
endfor
|
endfor
|
||||||
let g:best_combo_all = max(scores)
|
let g:best_combo_all = max(scores)
|
||||||
|
|
||||||
" Find best score for current filetype
|
" Checking for ignored extensions
|
||||||
if filereadable(g:combo_file)
|
let ignored = [ 'txt' ]
|
||||||
let g:best_combo = readfile(g:combo_file)
|
let g:disable_combo = 0
|
||||||
let g:best_combo = g:best_combo[0]
|
for f in ignored
|
||||||
|
if expand("%:e") == f
|
||||||
|
let g:disable_combo = 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
" If file should be ignored, just set text, else continue with script
|
||||||
|
if g:disable_combo
|
||||||
|
let g:airline_section_b = 'ᛥ -|-|%{g:best_combo_all}'
|
||||||
else
|
else
|
||||||
silent !echo 0 > $HOME/.vim/.combo/%:e.cmb
|
" Find best score for current filetype
|
||||||
let g:best_combo = 0
|
if filereadable(g:combo_file)
|
||||||
endif
|
let g:best_combo = readfile(g:combo_file)
|
||||||
|
let g:best_combo = g:best_combo[0]
|
||||||
" Configure variables
|
|
||||||
let g:combo_counter = 0 " The actual combo variable
|
|
||||||
let g:timeout = 1
|
|
||||||
let g:emphasis = ''
|
|
||||||
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()
|
|
||||||
if reltimefloat(reltime(g:last_combo)) > g:timeout
|
|
||||||
call SaveCombo()
|
|
||||||
let g:combo_counter = 1
|
|
||||||
else
|
else
|
||||||
let g:combo_counter +=1
|
silent !echo 0 > $HOME/.vim/.combo/%:e.cmb
|
||||||
|
let g:best_combo = 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Configure variables
|
||||||
|
let g:combo_counter = 0 " The actual combo variable
|
||||||
|
let g:timeout = 1
|
||||||
let g:emphasis = ''
|
let g:emphasis = ''
|
||||||
let ceil = g:combo_counter / g:mult
|
let g:mult = 10
|
||||||
let i = 0
|
let g:last_combo = reltime() " Set current time as last combo time
|
||||||
while i < ceil
|
let g:airline_section_b = 'ᛥ %{g:combo_counter}|%{g:best_combo}|%{g:best_combo_all} %{g:emphasis}'
|
||||||
let g:emphasis = g:emphasis . 'ᛞ'
|
function! UpdateCombo()
|
||||||
let i+=1
|
if reltimefloat(reltime(g:last_combo)) > g:timeout
|
||||||
endwhile
|
call SaveCombo()
|
||||||
let g:last_combo = reltime()
|
let g:combo_counter = 1
|
||||||
endfunction
|
else
|
||||||
function! SaveCombo()
|
let g:combo_counter +=1
|
||||||
if g:combo_counter > g:best_combo
|
endif
|
||||||
call writefile([g:combo_counter], g:combo_file)
|
let g:emphasis = ''
|
||||||
let g:best_combo = g:combo_counter
|
let ceil = g:combo_counter / g:mult
|
||||||
endif
|
let i = 0
|
||||||
endfunction
|
while i < ceil
|
||||||
|
let g:emphasis = g:emphasis . 'ᛞ'
|
||||||
autocmd TextChangedI * call UpdateCombo() " Every time the cursor moves, call combo function
|
let i+=1
|
||||||
autocmd InsertLeave * call SaveCombo()
|
endwhile
|
||||||
|
let g:last_combo = reltime()
|
||||||
" Options for Backspace Cheaters
|
endfunction
|
||||||
" inoremap <BS> <C-o>:let g:combo_counter-=1<CR><BS>
|
function! SaveCombo()
|
||||||
|
if g:combo_counter > g:best_combo
|
||||||
|
call writefile([g:combo_counter], g:combo_file)
|
||||||
|
let g:best_combo = g:combo_counter
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
autocmd TextChangedI * call UpdateCombo() " Every time the cursor moves, call combo function
|
||||||
|
autocmd InsertLeave * call SaveCombo()
|
||||||
|
|
||||||
|
" Options for Backspace Cheaters
|
||||||
|
" inoremap <BS> <C-o>:let g:combo_counter-=1<CR><BS>
|
||||||
|
endif
|
||||||
|
|
Loading…
Reference in a new issue