Add jq-pretty-print command

This commit is contained in:
Jeremy Dormitzer 2019-12-16 14:00:28 -05:00
parent a60c32e87a
commit 4a4975d5fa

View File

@ -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