Moved add-hook calls (for tree-sitter initialization) into their respective modes' config blocks, or nearby, to be consistent with how other, similar tools (like lsp!) are initialized, and does so at runtime, rather than at expansion/compile time, which eval-when! caused.
35 lines
975 B
EmacsLisp
35 lines
975 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))
|
|
(when (featurep! +tree-sitter)
|
|
(add-hook! '(json-mode-local-vars-hook
|
|
jsonc-mode-local-vars-hook)
|
|
:append #'tree-sitter!))
|
|
: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))
|