Added ignored files

This commit is contained in:
əlemi 2019-11-02 05:22:03 +01:00
parent 983b6925af
commit 8e52d7716d
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -14,23 +14,36 @@ 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:disable_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
" Find best score for current filetype
if filereadable(g:combo_file)
let g:best_combo = readfile(g:combo_file) let g:best_combo = readfile(g:combo_file)
let g:best_combo = g:best_combo[0] let g:best_combo = g:best_combo[0]
else else
silent !echo 0 > $HOME/.vim/.combo/%:e.cmb silent !echo 0 > $HOME/.vim/.combo/%:e.cmb
let g:best_combo = 0 let g:best_combo = 0
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:emphasis = '' let g:emphasis = ''
let g:mult = 10 let g:mult = 10
let g:last_combo = reltime() " Set current time as last combo time 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}' 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 if reltimefloat(reltime(g:last_combo)) > g:timeout
call SaveCombo() call SaveCombo()
let g:combo_counter = 1 let g:combo_counter = 1
@ -45,16 +58,17 @@ function! UpdateCombo()
let i+=1 let i+=1
endwhile endwhile
let g:last_combo = reltime() let g:last_combo = reltime()
endfunction endfunction
function! SaveCombo() function! SaveCombo()
if g:combo_counter > g:best_combo if g:combo_counter > g:best_combo
call writefile([g:combo_counter], g:combo_file) call writefile([g:combo_counter], g:combo_file)
let g:best_combo = g:combo_counter let g:best_combo = g:combo_counter
endif endif
endfunction endfunction
autocmd TextChangedI * call UpdateCombo() " Every time the cursor moves, call combo function autocmd TextChangedI * call UpdateCombo() " Every time the cursor moves, call combo function
autocmd InsertLeave * call SaveCombo() autocmd InsertLeave * call SaveCombo()
" Options for Backspace Cheaters " Options for Backspace Cheaters
" inoremap <BS> <C-o>:let g:combo_counter-=1<CR><BS> " inoremap <BS> <C-o>:let g:combo_counter-=1<CR><BS>
endif