Textern: edit Firefox textareas in Kakoune

Back in the days when Firefox had single-digit version numbers, there was an add-on called “It’s All Text” that let you edit the contents of a text-area in an external editor, with all your favourite keybindings, etc. Once Firefox replaced its old add-on ecosystem with WebExtensions, that extension died and I’ve been looking for a replacement ever since.

I recently found an add-on called Textern that does the same thing, but (in accordance with the WebExtensions security architecture) it comes in two parts - a Firefox extension that can be installed with a single click, and an external helper script written in Python with all the dependency hassle that implies.

So, I wrote my own external helper in Rust, so I can distribute a single statically-linked binary that basically Does The Right Thing. My project’s README has basic installation instructions if you’re interested - although I should note it currently only works on Linux, and I’ve only made a pre-built binary for x86_64. I created issues discussing macOS support and Windows support if anybody wants to help with those.

Specifically to make it work with Kakoune, I configured the external editor command to be:

["x-terminal-emulator", "-e", "kak", "%s", "+%l:%c"]

…because I’m using Debian and x-terminal-emulator is Debian for “my preferred terminal emulator”. It shouldn’t be difficult to figure out what to use on your system, especially if you’ve had to set the termcmd option in your kakrc.


Krabby https://krabby.netlify.app/ also has a feature to open in an external editor. Kakoune is supported.


Krabby has a similar feature by combining webextension-editor and webextension-shell.

The native messaging part is in Crystal, and is supported on Linux, macOS, but not Windows – Krabby – #23.

You can set the editor option to open Kakoune in Alacritty or another terminal:

alacritty --class 'Alacritty · Floating' --command \
  kak "${file}" -e "
    select ${anchor_line}.${anchor_column},${cursor_line}.${cursor_column}

Your helper is really handy. Thanks!

1 Like