mirror of
https://github.com/preservim/vim-wordy.git
synced 2025-11-08 09:53:50 -05:00
Merge pull request #28 from rndnoise/pr-19
Fix excessive regeneration of spelling dictionaries
This commit is contained in:
@@ -34,12 +34,17 @@ function! wordy#init(...) abort
|
|||||||
let l:src_path = l:data_dir . '/' . l:lang . '/' . l:dict . '.dic'
|
let l:src_path = l:data_dir . '/' . l:lang . '/' . l:dict . '.dic'
|
||||||
if filereadable(l:src_path)
|
if filereadable(l:src_path)
|
||||||
if has('nvim')
|
if has('nvim')
|
||||||
" Dynamically convert SpellBad words into SpellRare words under NeoVim.
|
let l:rare_path = l:src_path . '.rare'
|
||||||
" See issue 15 for details: https://github.com/reedes/vim-wordy/pull/15
|
if !filereadable(l:rare_path) ||
|
||||||
let l:rare_dic = map(readfile(l:src_path), "substitute(v:val, '!$', '?', '')")
|
\ getftime(l:rare_path) < getftime(l:src_path)
|
||||||
let l:src_path = tempname()
|
" Dynamically convert SpellBad words into SpellRare words under NeoVim.
|
||||||
call writefile(l:rare_dic, l:src_path)
|
" See issue 15 for details: https://github.com/reedes/vim-wordy/pull/15
|
||||||
|
let l:rare_dic = map(readfile(l:src_path), "substitute(v:val, '!$', '?', '')")
|
||||||
|
call writefile(l:rare_dic, l:rare_path)
|
||||||
|
endif
|
||||||
|
let l:src_path = l:rare_path
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:spell_dir = g:wordy_dir . '/spell'
|
let l:spell_dir = g:wordy_dir . '/spell'
|
||||||
if !isdirectory(l:spell_dir)
|
if !isdirectory(l:spell_dir)
|
||||||
call mkdir(expand(l:spell_dir), "p")
|
call mkdir(expand(l:spell_dir), "p")
|
||||||
|
|||||||
Reference in New Issue
Block a user