# Support for multiple dictionaries

**URL:** <https://discuss.kakoune.com/t/support-for-multiple-dictionaries/349>\
**Category:** Help\
**Created:** [February 26, 2019, 8:52am UTC](https://discuss.kakoune.com/t/support-for-multiple-dictionaries/349 "2019-02-26T08:52:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nonumeros](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/n/90ced4/32.png) [@nonumeros](https://discuss.kakoune.com/u/nonumeros)\
**Post date:** [February 26, 2019, 8:52am UTC](https://discuss.kakoune.com/t/support-for-multiple-dictionaries/349/1 "2019-02-26T08:52:44Z")

</div>

Normally, vim and its variants download dictionary files which can be invoked later on through spellcheck with `set spelllang=en,es spell` or `spelllang=en,fr spell` and so on.

Aspell normally allows to have an`--extra-dicts=` option in case of multiple dictionaries, or by specifying `-l` option with the dictionary of your choice.

I can have for example on **spell.kak** the following modification right after `eval`

```
 define-command spell-replace %{ evaluate-commands %sh{
if [-n "$kak_opt_spell_lang"]; then                    
    options="-l '$kak_opt_spell_lang'"
fi                                                             
suggestions=$(printf %s "$kak_selection" | eval "aspell -a -l es

```

which in turn will load the corresponding dictionary after `spell` is invoked without the need to specify the dictionary, and regardless of whatt the locale `LC_MESSAGES` is.

But I can’t figure out how to have both dictionaries.

---

<div class="post-metadata">

**Author:** ![andreyorst](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/andreyorst/32/29_2.png) [@andreyorst](https://discuss.kakoune.com/u/andreyorst)\
**Post date:** [February 26, 2019, 2:15pm UTC](https://discuss.kakoune.com/t/support-for-multiple-dictionaries/349/2 "2019-02-26T14:15:59Z")

</div>

My experience with **spell.kak** tells me to write something like Emacs’ Flyspell — an asynchronous spellchecking plugin for kakoune, that will constantly check spelling as you type, but I don’t really want to do it because it is tedious and I’m already maintaining somewhat complex plugins.

I wonder if there any language servers for spellchecking out there.

---

<div class="post-metadata">

**Author:** ![nonumeros](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/n/90ced4/32.png) [@nonumeros](https://discuss.kakoune.com/u/nonumeros)\
**Post date:** [February 27, 2019, 5:29am UTC](https://discuss.kakoune.com/t/support-for-multiple-dictionaries/349/3 "2019-02-27T05:29:22Z")

</div>

I was only able to get so far. It’s just interesting what the outcome turned out to be. Some words are recognized, while others are not. I think this may have something to do woth the way the encoding is exercised while creating the file from a word list.

I downloaded some of the dictionaries from [this github repo](https://github.com/titoBouzout/Dictionaries)

And I created my own word list and named the file _myapell.dic_

On [Aspell Creating an Individual Word List](http://aspell.net/man-html/Creating-an-Individual-Word-List.html#Creating-an-Individual-Word-List) it says to specify the _base_ on the current directory, or else it will create the file on the word list dictionaries at **/usr/lib/aspell/**.

I had made the mistake of creating the master file without the prefix, and it wasn’t until later when I realized it.

The reason was that I had come across this  
[post](https://www.linuxquestions.org/questions/red-hat-31/facing-issue-with-aspell-conversion-of-rws-file-to-txt-file-4175504036/) from [linuxquestions.org](http://linuxquestions.org) in which the op didn’t specify it. But it’s fine. Since I could always remove it.

Then

```
 $ aspell --lang=es --encoding=utf-8 create master mydic.rws <
 myaspell.dic

```

Then back on **spell.kak**

I added

```
 -d mydic.rws 

```

to line 31 and 113 of the file.

But unfortunately, some of the words are not even recognized. e.g., thistle and thistles are fine, third and thirds are not

**Edited** :

I also read some of the explanation given by the chromium Project about some of the rules that are in use with the `.aff` files fromHunspell. See  
[https://www.chromium.org/developers/how-tos/editing-the-spell-checking-dictionaries](https://www.chromium.org/developers/how-tos/editing-the-spell-checking-dictionaries).

This should apply as well to Aspell `.aff` files and `.dat` files from Aspell.

But I also tweaked around with `dump master` while trying to modify the word list from Aspell itself, especially after reading  
[https://superuser.com/a/137990](https://superuser.com/a/137990) , Aspell seemed to depend largely on the base dictionary itself.

So while creating the file from say both **en** and **es** dictionaries, `--lang` applies to only one. The end result is that it recognizes only one dictionary.

One of the hints by which I have relied, is by having (without modifying any of the dic files) under English the word ‘thirds’ and in Spanish the word ‘perseverarías’ , both properly recognized.

If anyone has a working solution by going this route, please let me know.

---

<div class="post-metadata">

**Author:** ![TeddyDD](https://discuss.kakoune.com/user_avatar/discuss.kakoune.com/teddydd/32/21_2.png) [@TeddyDD](https://discuss.kakoune.com/u/TeddyDD)\
**Post date:** [March 1, 2019, 12:56pm UTC](https://discuss.kakoune.com/t/support-for-multiple-dictionaries/349/4 "2019-03-01T12:56:00Z")

</div>

Probably related [post](https://discuss.kakoune.com/t/plugins-ideas/74/24?u=teddydd)

---

<div class="post-metadata">

**Author:** ![nonumeros](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/n/90ced4/32.png) [@nonumeros](https://discuss.kakoune.com/u/nonumeros)\
**Post date:** [March 3, 2019, 10:29pm UTC](https://discuss.kakoune.com/t/support-for-multiple-dictionaries/349/5 "2019-03-03T22:29:33Z")

</div>

I’ve given up on trying to have Aspell working for this use case. Even by having a conf file in place, and by tweaking around with the list option, and the boolean option, it didn’t work.

As far as I can tell, and going by the [Aspell Customizing suggestion](http://aspell.net/0.50-doc/man-html/4_Customizing.html#suggestion) that appears on the documentation page, there is no possible way to go around this issue.

What I do have in place and which seems to work for now is with Hunspell on the spell.kak file instead.

---

<div class="post-metadata">

**Author:** ![nonumeros](https://discuss.kakoune.com/letter_avatar_proxy/v4/letter/n/90ced4/32.png) [@nonumeros](https://discuss.kakoune.com/u/nonumeros)\
**Post date:** [March 4, 2019, 7:43am UTC](https://discuss.kakoune.com/t/support-for-multiple-dictionaries/349/6 "2019-03-04T07:43:29Z")

</div>

> My experience with **spell.kak** tells me to write something like Emacs’ Flyspell

The last time I checked Emacs, the function `ispell-change-dictionary` did absolutely nothing with my issue.

[Emacs. Spell check “on fly” for 2 languages](https://stackoverflow.com/questions/42159012/emacs-spell-check-on-fly-for-2-languages)

What if anything clears my buffer without further overfilling the init file is jlust beyond me. What does `ispell-kill-ispell` exactly does, is just another lingering question.

So, `fly-spell-mode` should be disabled, and it seems fine as soon as meta is invoked again, but then as soon as you enable it whatever changes were made in the form of a curvy underlined notation, goes away too. Lisp must be dead. And by then, one might kiss the kiss principle away as well.  
And please, I have zero intention of instigating a flame here.

I don’t know vimscript but I can’t deny either that they didn’t give it some thought to implement `mkspell`

[vim runtime spell](https://github.com/vim/vim/tree/master/runtime/spell)

Right now I have `hunspell -d es_MX,en_US -a ` on **spell.kak** and does exactly what I need

PS: I still find some of the Emacs modes, extremely useful, but if the amount of keystrokes it takes to perform a task are greater, it defeats its utility,
