Run jq on a json buffer, and interactively update the output window whenever the input buffer or the jq filter buffer are modified similar to jqplay.o

bfrg / vim-jqplay

submited by
Style Pass
2021-07-24 13:00:15

Run jq on a json buffer, and interactively update the output window whenever the input buffer or the jq filter buffer are modified similar to jqplay.org.

Run :Jqplay {args} to start an interactive jq session using the current json buffer and the jq options {args}. The command will open two new windows:

{args} can be any jq command-line arguments as you would write them in the shell (except for the -f/--from-file option and the filter).

Jq will be invoked automatically whenever the input buffer or the jq filter buffer are modified. By default jq is invoked when the InsertLeave or TextChanged events are triggered. See configuration below for how to change the list of events when jq is invoked.

Run :Jqrun {args} at any time to invoke jq manually with the jq arguments {args} and the current jq-filter:// buffer. This will temporarily override the jq options previously set when starting the session with :Jqplay {args}. Add a bang to :Jqrun! to permanently override the options for the jq-filter:// buffer.

:Jqrun is useful to quickly run the same jq script with different set of jq arguments. Alternatively, if you don't want to run jq interactively on every buffer change, disable all autocommands and use :Jqrun instead.

Leave a Comment
Related Posts