From b3c7e6b9e7652a41e3d1b6db1201777e63e6180b Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Sun, 14 Jun 2020 12:26:31 -0400 Subject: [PATCH] Set up tree-mode for json-navigator-mode --- emacs/init.org | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/emacs/init.org b/emacs/init.org index 879b5cb..a24afcb 100755 --- a/emacs/init.org +++ b/emacs/init.org @@ -2719,16 +2719,35 @@ Like [[help:electric-indent-mode][electric-indent-mode]] but reindents after eve (use-package json-navigator :commands (json-navigator-navigator - json-navigator-navigate-after-point - json-navigator-navigate-region)) + json-navigator-navigate-after-point + json-navigator-navigate-region)) + + (use-package tree-mode + :general + (normal tree-mode-map + "D" #'tree-mode-delete-tree + "k" #'tree-mode-previous-node + "j" #'tree-mode-next-node + "l" #'tree-mode-next-sib + "h" #'tree-mode-previous-sib + "u" #'tree-mode-goto-parent + "r" #'tree-mode-goto-root + "gr" #'tree-mode-reflesh + "E" #'tree-mode-expand-level + "e" #'tree-mode-toggle-expand + "s" #'tree-mode-sort-by-tag + "/" #'tree-mode-keep-match + "!" #'tree-mode-collapse-other-except) + :hook + ((json-navigator-mode . tree-minor-mode))) (defun json-pprint () (interactive) (let ((begin (if (region-active-p) (region-beginning) (point-min))) - (end (if (region-active-p) (region-end) (point-max)))) + (end (if (region-active-p) (region-end) (point-max)))) (if (executable-find "jq") - (shell-command-on-region begin end "jq ." nil t) - (json-pretty-print begin end)))) + (shell-command-on-region begin end "jq ." nil t) + (json-pretty-print begin end)))) (general-def json-mode-map "C-M-\\" 'json-pprint) #+END_SRC