Quick-Dev - Quickly write and reload kakscript without breaking your workflow

I’ve often been working on something that’s made me think, “it would probably be easy to write a plugin to streamline this.”

But 9 times out of 10 (or more like 99 out of 100), I’m not going to: start a new script, source it in my kakrc, restart Kakoune, go back to the original context from which I had the idea, test out the new script, find a problem…

In order to circumvent the pain of the above workflow, I put together this plugin to make prototyping plugins easier:

  1. Idea Appears in Brain
  2. <space>qe (open the Quick-Dev Scratchpad)
  3. Bust out some rough kakscript to minimally test the idea.
  4. <space>qr (re-load the scratchpad code)
  5. ga (go back to original context)
  6. Test it out.
  7. Repeat 2-6 while making small, incremental changes until it works how I want.
  8. Extract the code into a new plugin (eventually, when I get around to it).

The core idea is to use a little discipline to write kakscript that’s reloadable, then simply (re)source it. Additionally, the provided scratchpad file can be opened at a keystroke, and includes example kakscript to get started without having to reference 5 :doc pages to remember how to do the thing.

This is a little rough around the edges, but I’ve found it extremely useful myself, so I thought I’d share it.

Spin-offs or suggestions are welcome.


I had a look at this, and you should be able to remove the assumption that it’s installed in plug.kak’s default installation path by changing the paths in plugin-quick-dev.kak to $(dirname $kak_source)/quick-dev-scratchpad.kak and $(dirname $kak_source)/quick-dev-scratchpad.template (warning: untested).

This looks very cool though.

1 Like

Thanks for the tip! %val{source} was key to fixing the static path situation. I updated it so that you should now be able to install it from any local directory.