diff options
author | Oscar Najera <hi@oscarnajera.com> | 2024-08-19 01:18:53 +0200 |
---|---|---|
committer | Oscar Najera <hi@oscarnajera.com> | 2024-08-19 01:18:53 +0200 |
commit | 8c3168d2855818847e09dd21f5edc4aacadb13a9 (patch) | |
tree | 2f8e0c8b506fce0ffeeb95febed04bda563fec66 /config/doom | |
parent | 6fcff0d748eef1998cec47470f10f64c66d5aa99 (diff) | |
download | dotfiles-8c3168d2855818847e09dd21f5edc4aacadb13a9.tar.gz dotfiles-8c3168d2855818847e09dd21f5edc4aacadb13a9.tar.bz2 dotfiles-8c3168d2855818847e09dd21f5edc4aacadb13a9.zip |
khardel imenu
Diffstat (limited to 'config/doom')
-rw-r--r-- | config/doom/config.org | 17 |
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))) |