Konfekt / vim-DetectSpellLang

make Vim autodetect the spellcheck language of the opened buffer
Other
23 stars 4 forks source link

Guessing second tongue other than English installed #10

Open Kamilcuk opened 2 months ago

Kamilcuk commented 2 months ago

Hi, I understand that detectspelllang is guessing the available hunspell or aspell dictionaries.

But every time I enter vim it tells me about it.

Could it do it silently?

I have written vimscript parsing for extracting dicts:

        if executable("aspell")
          let aspell_dicts = systemlist("aspell dicts")
          let aspell_dicts = uniq(map(aspell_dicts, {key, val -> substitute(val, '-[^\n]*', '', '')}))
          let g:detectspelllang_program = "aspell"
          let g:detectspelllang_langs = { "aspell": aspell_dicts }
        else
          let output = system("env LANG=C hunspell -D")
          let output = substitute(
               \ output,
                \ '.*AVAILABLE DICTIONARIES[^\n]*\n\(.*\)[^\n]*\(LOADED DICTIONARIES.*\|$\)',
               \ '\1',
               \ '')
          let hunspell_dicts = map(split(output), {key, val -> substitute(val, ".*\/", "", "")})
          let g:detectspelllang_program = "hunspell"
          let g:detectspelllang_langs = { "hunspell": hunspell_dicts }
        endif
Konfekt commented 2 months ago

Hello, thank you for your kind suggestion. I hope it works as intended.