Kakoune-languagetool adds prose linting to Kakoune

I love getting inline errors and warnings when I’m writing code, but there’s not nearly as many helpful tools for editing prose. LanguageTool is Open Source software that can do spelling and grammar checking, but unfortunately it doesn’t present its warnings in a form that Kakoune’s lint plugin understands. So I wrote a wrapper script to reformat the output, and stuck it in a git repo just in case anybody else would find it handy:

It’s pretty hacky, even by my standards, and LanguageTool is a heavy-weight dependency (nearly a 200MB download, plus it requires a Java runtime) but the first Markdown file I tried it on, it found a bunch of accidentally-doubled words and some surplus punctuation.

Does anybody else have a favourite proofreading tool that works with Kakoune? Maybe we can start a wiki page or something.

5 Likes

I think you forgot to put the scope on the README example:

hook global WinSetOption filetype=markdown %{

I’ve been happily using proselint for a while.

2 Likes

Ah, yes, proselint! I remember somebody else mentioning it to me a while ago. As a Python tool, it’s a lot lighter-weight than LanguageTool, and I think the Python runtime is more widely available (on Linux) than the Java runtime, which is an additional benefit. Most usefully, it produces Kakoune-compatible output directly, with no need for an extra wrapper script.

On the other hand, it seems to treat every line-break as a new paragraph, which means that when a line happens to begin with the word “but” it triggers the “don’t use ‘but’ at the beginning of a paragraph” warning, even if the “but” happens to be in the middle of a sentence where it should be. And while most lint tools allow you to enable and disable individual lints, proselint does not — it’s all or nothing. And even that wouldn’t be so bad if the broken lint could be fixed, but there’s been a PR for it open since 2017-03, which doesn’t inspire confidence.

I guess I’ll try to exercise both for a while, and see which set of trade-offs I prefer.

I have used https://github.com/languagetool-language-server/languagetool-languageserver in the past. But currently I have it commented out in my kak-lsp, so I assume that I encountered some problems with it.
But I think writing a language server for it is the way to go for a less hacky solution.

Hey, I’ve been throwing together this very simple yet reliable (so far) program to cover my use-cases.

As there is little to none docs, here is the relevant part where I store what I use: errfmt/src/errfmt.rs at 16a6ba1d2272e7f20c5a58a97977df549572cbb9 · mzanibelli/errfmt · GitHub

Apart from specific shell wrappers, do you know of any existing solution that can emulate Vim’s errorformat feature a bit better?

Cheers