mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-31 14:43:40 -05:00
Some how for some reason tree-sitter-langs managed to load. If if put its require in the block of a lazy loaded package. it would load. If i were to set its use-package call to load it after a lazy loaded package. it would load. a hook (and disabling it) were the only reliable ways to get it to lazy load
36 lines
1.5 KiB
EmacsLisp
36 lines
1.5 KiB
EmacsLisp
;;; tools/tree-sitter/config.el -*- lexical-binding: t; -*-
|
|
|
|
(use-package! tree-sitter
|
|
:hook (prog-mode . turn-on-tree-sitter-mode)
|
|
:hook (tree-sitter-after-on . tree-sitter-hl-mode)
|
|
:config
|
|
;; This makes every node a link to a section of code
|
|
(setq tree-sitter-debug-jump-buttons t
|
|
;; and this highlights the entire sub tree in your code
|
|
tree-sitter-debug-highlight-jump-region t))
|
|
|
|
(add-hook! 'tree-sitter-after-on-hook (require 'tree-sitter-langs))
|
|
|
|
(when (featurep! :editor evil +everywhere)
|
|
(use-package! evil-textobj-tree-sitter
|
|
:after tree-sitter
|
|
:config
|
|
;; FIXME: only bind when using a supported major mode
|
|
(map!
|
|
:textobj "f" nil nil
|
|
:textobj "f" (evil-textobj-tree-sitter-get-textobj "function.inner") (evil-textobj-tree-sitter-get-textobj "function.outer") ;; redef
|
|
|
|
:textobj "F" (evil-textobj-tree-sitter-get-textobj "call.inner") (evil-textobj-tree-sitter-get-textobj "call.outer")
|
|
|
|
:textobj "C" (evil-textobj-tree-sitter-get-textobj "class.inner") (evil-textobj-tree-sitter-get-textobj "class.outer")
|
|
|
|
:textobj "c" nil nil
|
|
:textobj "c" nil (evil-textobj-tree-sitter-get-textobj "comment.outer")
|
|
|
|
:textobj "i" nil nil
|
|
:textobj "i" (evil-textobj-tree-sitter-get-textobj "conditional.inner") (evil-textobj-tree-sitter-get-textobj "conditional.outer")
|
|
|
|
:textobj "l" nil nil
|
|
:textobj "l" (evil-textobj-tree-sitter-get-textobj "loop.inner") (evil-textobj-tree-sitter-get-textobj "loop.outer"))))
|
|
|