Alternate implementation for spell checker


Frustrated by some limitations of the default spell plugin, I decided to try and rewrite it from scratch to make it more flexible and hackable - which involves writing as little KakScript as possible (for me at least)


  • leverage existing lint.kak plugin for jumping to mistakes
  • show a menu with suggestions
  • New: add and remove kakoune selections to and from personal word list - this is what I missed the most when coming from vim
  • New: use any backend supported by enchant, not just aspell

Enough talk, show me the code!

There are two parts:

The first part is a Python script that wraps enchant:

Note that the logic to display the kakoune completion menu is implemented there, where it is easy to test/debug :slight_smile:

The second part is a rewrite from scratch of the spell.kak implementation. You can see the diff on GitHub

I hope you’ll agree it’s easier to read, maintain and extend.

Future work

Right now the plugin can only be used by patching the code of kakoune and installing a separate python project (and deal with pyenchant)

This not ideal, so if you like the idea of such a plugin and its implementation, feel free to tell me below and we can discuss easier ways to distribute the plugin - I kinda like the idea of just a Rust binary, ala kak-slp.

Also, I’m pretty satisfied with the features so far, but let me know if you have requests that would be hard to implement in the original spell.kak plugin (besides checking several languages at once - this is sadly not supported by Enchant)



I will test with it soon, it sounds very promising!
For distributing I suggest that you put it into a git repository so that it can be loaded by plug.kak

The second part is a rewrite from scratch of the plug.kak implementation.

You mean of the spell.kak implementation?

You mean of the spell.kak implementation?

Woops sorry :slight_smile: My mind was already thinking about distribution and plug.kak was typed …

1 Like

I am going to give this a run, currently using dictcomplete.kak. I’ll be back, bye.

A stumbling block for me is lint-on-save cannot find any reference to this command. Can you please explain its purpose, usage, or help me if I am doing something wrong. Thanks Dmere.

A stumbling block for me is lint-on-save

Woops, sorry. This is a command that adds a hook to call :lint when the buffer is saved.

Here is its implementation:

define-command lint-on-save "hook buffer BufWritePre .* lint"

It lives in my kakrc config file and I forgot that kak-spell depended on it …

Thank you. I’ll be back with some feedback or more questions, probably both :smile: