Emacs major mode for editing jq queries.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Test file should use ob-jq name Oct 25, 2015
COPYING
README.org Add :compact parameter. Apr 7, 2018
jq-mode.el Get output from 'builtins' to get all builtins in jq Nov 3, 2018
ob-jq.el Add :compact parameter. Apr 7, 2018

README.org

What is it?

jq-mode is an emacs major mode for editing jq-scripts.

Getting started

https://melpa.org/packages/jq-mode-badge.svg https://stable.melpa.org/packages/jq-mode-badge.svg

  • Download jq-mode.el and put it in a directory somewhere.
  • Add the following to your .emacs file
(add-to-list 'load-path "/path/to/jq-mode-dir")
(autoload 'jq-mode "jq-mode.el"
    "Major mode for editing jq files" t)
(add-to-list 'auto-mode-alist '("\\.jq$" . jq-mode))

Now jq-mode will load whenever you visit a file whose name ends with .jq. Alternatively, run M-x jq-mode in an existing buffer containing jq commands.

Interactive mode

jq-mode can also be used interactively in a JSON buffer. If you add the following to your .emacs file

(with-eval-after-load "json-mode"
  (define-key json-mode-map (kbd "C-c C-j") #'jq-interactively))

or you can call M-x jq-interactivly. jq-interactively runs the expression that is written in the minibuffer iteratively over the JSON buffer. Press C-g to abort, C-j for newline, RET commits any changes.

Org babel

jq-mode provides ob-jq for working with literate programming in Org mode.

jq specific header arguments

ob-jq provides some additional header arguments:

:compact
Add -c to jq arguments list suppressing pretty printing

Bugs and Enhancements

If you have a problem or would like to see it get better in a specific way, feel free to drop an issue in the issue tracker. Enjoy!