Jq Playground in the style of vim-jqplay?

Hi, folks. I have no idea how much effort this would take, so I’ll throw the idea out there and hope someone has time, energy, and interest.

I’m working quite often in jq these days and looking around to helpful tools. Today I stumbled open a playground for jq in vim and since I don’t speak vim plugins fluently, I can’t tell how difficult (or interesting!) it would be to try to build this for kak.

If you’re looking for a project, I’m proposing this one. :slight_smile:

1 Like

I’m not familiar with jq but I’ve looked at this. I feel like this would be incredibly easy to do in kakoune. You would just have to use the built-in pipe command. (| in normal mode) The steps would be something like:

  1. Get the jq filter from somewhere. You could either read it from a buffer or from a kakoune option
  2. Setup a input and a output buffer
  3. Set up a hook to copy the input buffer into the output buffer and run something like execute-keys %exp{%%|jq %opt{jq_play_fillter} in the output buffer whenever the input buffer or filter buffer/option is modified
1 Like

Hello there! I have now created a jq play plugin for kakoune. It turned out to be really easy to do. The plugin is only 38 lines long (if you don’t count comments and blank lines).

1 Like

First, thank you. Second, I am interested in the code as a way to understand what it takes to build a plugin for kakoune.