Alternate implementation for spell checker

Hi,

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)

Features

  • 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)

Cheers!

4 Likes

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