I love that Kakoune is so eager to provide completions in every situation, but the built-in completions that work so well for code (like completing words from other open buffers) don’t work well for prose. Meanwhile, when I have to type things on my phone… well, it’s not a great experience because of the tiny keyboard, but predictive text makes it much, much better than it otherwise would be. I tried straight-up loading the entire contents of
/usr/share/dict/words into Kakoune’s completion engine, but that only made things worse - without frequency information, the majority of predictions are just distraction.
So, to get the predictive-text experience I wanted, I made a plugin:
You can enable it on a per-window basis, so you can keep it disabled for buffers where predictive text is not helpful. It also provides predictions on a per-filetype basis, so it won’t predict Python keywords in C++ files.
I just got it working and I’m going to use it for a while to see whether the predictions get more or less helpful over time. If they get less helpful, I might try tweaking it a bit.
Currently, there’s no attempt at dealing with upper-case or lower-case and no English-language assumptions like “the word after a period should start with a capital letter”, it’s all about the sequence of tokens you’d select by pressing
If you’re not interested in predictive-text specifically, you might be interested in:
- building a regex to match the buffer’s definition of a “word”
- building a list of completion candidates in SQL
- generating SQL with AWK (“SQAWK” for short?)
adding link targets to options and commands in the docs so you can
:doc predictive-text predictive-text-enableto go straight to the docs for that command instead of saying
:doc predictive-text commandsand making people search