diff --git a/emacs/init.org b/emacs/init.org index 4109473..6c1ffbc 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -1468,6 +1468,14 @@ Some aliases: :commands (json-navigator-navigator json-navigator-navigate-after-point json-navigator-navigate-region)) + + (defun jq-pretty-print () + (interactive) + (let ((begin (if (region-active-p) (region-beginning) (point-min))) + (end (if (region-active-p) (region-end) (point-max)))) + (shell-command-on-region begin end "jq ." nil t))) + + (general-def json-mode-map "C-M-\\" 'jq-pretty-print) #+END_SRC * JavaScript