Kakoune is an Unlicense licensed terminal modal text editor written in [[C++]].
- [Website](http://kakoune.org/)
- [GitHub](https://github.com/mawww/kakoune)
- [AlternativeTo](https://alternativeto.net/software/kakoune/about/)
> Kakoune is a code editor that implements Vi’s "keystrokes as a text editing language" model.
# Notability
It is an interesting experiment in user experience because it is not just a Vim clone, but intentionally works to improve and expand upon [[vi]]'s keyboard interaction model.
# Philosophy
> Unlike Vim, Kakoune does not have an underlying line-oriented editor. It is always expected to be used in an interactive fashion, displaying edited text in real time.
> Kakoune has a strong focus on interactivity. Most commands provide immediate and incremental results, while being competitive with Vim in terms of keystroke count.
> Kakoune is a code editor. It is not an IDE, not a file browser, not a word processor and not a window manager. It should be very efficient at editing code. As a side effect, it should be very efficient at editing text in general.
> Kakoune is expected to run on a Unix-like system alongside a lot of text-based tools, and should make it easy to interact with these tools.
>
> For example, sorting lines should be done using the Unix sort command, not with an internal implementation. Kakoune should make it easy to do that, hence the `|` command for piping selected text through a filter.
> Most editing tasks should be doable in fewer or the same number of keystrokes as Vim.
>
> Kakoune is designed with asynchronicity in mind. Launching a background process and using its result when available should not block the editor.
>
> Kakoune should be implemented with speed in mind. A slow editor is a useless one.
> A 4x speed improvement is meaningless; we need to have an algorithm which appears instantaneous to the user.
# OS Support
- [[Linux]]
- [[MacOS]]
- [[Windows]]
# Features
## Scripting
Kakoune does not have a built-in fully-formed scripting language nor a binary API. It expects that extensions to functionality are done via filtering selections through external commands and a socket interface.
However, it does have a declarative command language sometimes called `kak` or `KakouneScript` used for defining color themes, hotkeys, and gluing together external commands.
> Kakscript does not have any control flow beyond a simple try/catch mechanism - for anything complex, you use shell scripting. It is both a blessing and a curse - making it extremely easy to integrate with other tools, but causing some pain if you don't know shell scripting already.
\- via [a commentor on Hacker News](https://news.ycombinator.com/item?id=29975769)
>[!WARNING] Consequences
> In theory, this creates a clean separation of responsibilities and greatly simplifies the design of the application's core as well as keeping external functionality self-contained and extremely portable.
>
> In practice, this means that [[sh]] is used as the scripting language to maintain portability.
>
> There is a complex relationship between expansions and environment variables in order to make this work.
>
> This makes even moderately complex `kak` files horrific to read with multiple layers of Kakoune's expansion syntax and editor commands all intermingled with `sh` script that no human or editor - Kakourne included - can easily read or syntax highlight.
>
> See the [ctags.kak](https://github.com/mawww/kakoune/blob/cfa658b899b44a8a0f4c7f3dd9811ae0d44ddd3a/rc/tools/ctags.kak#L4) integration for example.
>
> I posit that this design decision is a primary motivator for other projects to take the core concepts of Kakoune and change the rest dramatically - as seen with [[Helix]].