auto create .combo folder if missing
This commit is contained in:
parent
819531a2da
commit
08201add5c
1 changed files with 10 additions and 21 deletions
|
@ -1,27 +1,16 @@
|
||||||
" COMBO Counter
|
" COMBO Counter
|
||||||
" Choose combo file depending on extension
|
" Choose combo file depending on extension
|
||||||
if strlen(expand("%:e")) > 0
|
|
||||||
let g:combo_file = $HOME . '/.vim/.combo/' . expand("%:e") . ".cmb"
|
" Check for a .combo folder, make one if missing
|
||||||
else
|
if !isdirectory($HOME . '/.vim/.combo')
|
||||||
let g:combo_file = $HOME . '/.vim/.combo/none.cmb'
|
silent !mkdir $HOME/.vim/.combo
|
||||||
|
endif
|
||||||
|
" Get extension, choose combo file
|
||||||
|
if strlen(expand("%:e")) > 0
|
||||||
|
let g:combo_file = $HOME . '/.vim/.combo/' . expand("%:e") . ".cmb"
|
||||||
|
else
|
||||||
|
let g:combo_file = $HOME . '/.vim/.combo/none.cmb'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Find best score across all filetypes
|
|
||||||
let scores = []
|
|
||||||
for f in split(globpath($HOME . '/.vim/.combo/', '*'), '\n')
|
|
||||||
let buf = readfile(f)
|
|
||||||
call insert(scores, buf[0])
|
|
||||||
endfor
|
|
||||||
let g:best_combo_all = max(scores)
|
|
||||||
|
|
||||||
" Checking for ignored extensions
|
|
||||||
let ignored = ['cmb']
|
|
||||||
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 file should be ignored, just set text, else continue with script
|
||||||
if g:disable_combo
|
if g:disable_combo
|
||||||
|
|
Loading…
Reference in a new issue