doomemacs/modules/lang/json/config.el
Jeetaditya Chatterjee 06ed5ade3f
refactor!(tree-sitter): add +tree-sitter flag
BREAKING CHANGE: break the global nature of the tree sitter
module by adding a +tree-sitter flag to every applicable module

In the background this hooks turn-on-tree-sitter-mode
to the major-mode-hook of the language.
This may also solve the eager loading of tree sitter
2022-05-22 21:26:00 +01:00

35 lines
933 B
EmacsLisp

;;; lang/json/config.el -*- lexical-binding: t; -*-
(use-package! json-mode
:mode "\\.js\\(?:on\\|[hl]int\\(?:rc\\)?\\)\\'"
:init
(when (featurep! +lsp)
(add-hook 'json-mode-local-vars-hook #'lsp! 'append))
:config
(set-electric! 'json-mode :chars '(?\n ?: ?{ ?}))
(map! :after json-mode
:map json-mode-map
:localleader
:desc "Copy path" "p" #'json-mode-show-path
"t" #'json-toggle-boolean
"d" #'json-mode-kill-path
"x" #'json-nullify-sexp
"+" #'json-increment-number-at-point
"-" #'json-decrement-number-at-point
"f" #'json-mode-beautify))
(use-package! counsel-jq
:when (featurep! :completion ivy)
:defer t
:init
(map! :after json-mode
:map json-mode-map
:localleader
"s" #'counsel-jq))
(eval-when! (featurep! +tree-sitter)
(add-hook! '(json-mode
jsonc-mode) #'turn-on-tree-sitter-mode))