These past few days I’ve been working on a new plugin, popup.kak. This lets you create interactive info modals that could contain a shell or command and make use of their standard output. Here’s a demo:
An example invocation looks something like this:
popup --title open --kak-script %{ edit %opt{popup_output} } -- fish -c __fzf_find
And shows up like this:
I think it’s mostly free of bugs in its current state, but there are some missing features, namely:
- Have a way to pass standard input to the command in the popup. This could be super useful through kak-lsp to find references without having to jump to a buffer.
- Color support (this is kind of annoying, I’ll have to write a clone of kak-ansi).
- Display where the cursor is.
Implementation
This is implemented using a tmux session, that is actually holding the state of the modal. The tmux session is periodically queried, and the info modal is updated if anything has changed. Keys are captured using a recursive on-key
command, and sent to the tmux session. Lastly standard error and standard out are captured by augmenting the provided command with some bash redirection.
Why
Well, I really like switching to new files fuzzily, and from within my kakoune instance. I currently use a hacky wrapper around a terminal multiplexer to overlay an instance of fzf
to switch between files. I wanted to see if it was possible to do something similar without wrapping kakoune in a multiplexer.
Let me know what you guys think!