I know this has been asked many times, but the answers don't seem to do it for me.
How do you get Flyspell to work with hunspell?
After installing the hunspell executables via mingw-64-hunspell using MSYS 2 and adding dictionaries, I can successfully check words with the from MSYS shell like so:
$ echo baddword | hunspell -d en_US Hunspell 1.4.0 & baddword 1 0: broadsword
On emacs i set the following in my config (.spacemacs dotspacemacs/user-config)
(setq ispell-dictionary nil) (setq ispell-program-name "c:/msys64/mingw64/bin/hunspell.exe") ;; "en_US" is key to lookup in `ispell-local-dictionary-alist`, please note it will be passed to hunspell CLI as "-d" parameter (setq ispell-local-dictionary "en_US") (setq ispell-local-dictionary-alist '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8)))
Saved the config and restarted the program. When I type nonsense words, nothing is highlighted. However, I can do spell-check via the
spell check buffer command. The bizarre thing however that this command only worked a couple of times and only on the
.spacemacs file. Whenever I open a new empty buffer, it complains that it "can't open affix or dictionary files for dictionary ENU". I never specified an "ENU" dictionary anywhere, so that's not surprising. Also it starts a new "ispell process" every time I open a new file, which slows down performance by about 5 seconds.
TL;DR: how do you get a working spell checker that behaves like the spell-checker in your browser?
more on spell-checking in spacemacs, though I don't see any useful info there
I used a slightly different config before that and it worked with warnings. After adding DICTPATH and the this code to init, everything works well.
(setenv "LANG" "en_US, ru_RU") (setq-default ispell-program-name "c:/msys64/mingw64/bin/hunspell.exe") (with-eval-after-load "ispell" (setq ispell-really-hunspell t) (setq ispell-program-name "hunspell") (setq ispell-dictionary "en_US,ru_RU") ;; ispell-set-spellchecker-params has to be called ;; before ispell-hunspell-add-multi-dic will work (ispell-set-spellchecker-params) (ispell-hunspell-add-multi-dic "en_US,ru_RU"))
ispell-program-nameI just have
((ispell-change-dictionary "en_GB" t)and it works fine now. Does that help?
(setq ispell-program-name c:/msys64/mingw64/bin/hunspell.exe") (ispell-change-dictionary "en_GB" t)and nothing else. same result.
(setenv "LANG" "en_GB")in my startup. The "ENU" specifier is the one hunspell was getting by default from Windows 10, so I gave it a *nix-like Lang setting. With your setup I guess you might try "en_US".