Set up tree-mode for json-navigator-mode
This commit is contained in:
parent
815745acc9
commit
b3c7e6b9e7
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user