aboutsummaryrefslogtreecommitdiffstats
path: root/config/doom
diff options
context:
space:
mode:
Diffstat (limited to 'config/doom')
-rw-r--r--config/doom/config.org17
1 files changed, 13 insertions, 4 deletions
diff --git a/config/doom/config.org b/config/doom/config.org
index 6a2df58..8c32144 100644
--- a/config/doom/config.org
+++ b/config/doom/config.org
@@ -501,7 +501,14 @@ this new window.
(package! khardel)
#+end_src
#+begin_src emacs-lisp
-(use-package! khardel)
+(use-package! khardel
+ :config
+ (after! tree-sitter-langs
+ (add-to-list 'tree-sitter-major-mode-language-alist '(khardel-edit-mode . yaml)))
+ (add-hook 'khardel-edit-mode-hook
+ (lambda ()
+ (tree-sitter-mode)
+ (setq imenu-create-index-function #'on/imenu-nested-path-elements))))
#+end_src
* IRC
#+begin_src emacs-lisp
@@ -611,9 +618,11 @@ Emacs mode for managing ledger text files
(defun on/ts-elements ()
"Tree sitter matches for all entries in data buffer."
(let ((query (thread-last
- (pcase major-mode
- ('json-mode "(object (pair (string (string_content) @key) (_)) @item)")
- ('yaml-mode "(block_mapping_pair (flow_node) @key (_)) @item"))
+ (cond
+ ((derived-mode-p 'json-mode)
+ "(object (pair (string (string_content) @key) (_)) @item)")
+ ((derived-mode-p 'yaml-mode)
+ "(block_mapping_pair (flow_node) @key (_)) @item"))
(tsc-make-query tree-sitter-language)))
(root-node (tsc-root-node tree-sitter-tree)))
(tsc-query-matches query root-node #'tsc--buffer-substring-no-properties)))