From 4a4975d5fa680cd46a7ee89c4688053b089a1f26 Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Mon, 16 Dec 2019 14:00:28 -0500 Subject: [PATCH] Add jq-pretty-print command --- emacs/init.org | 8 ++++++++ 1 file changed, 8 insertions(+) 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