Last active
July 7, 2024 23:56
-
-
Save lispandfound/a72f2dda6b8c1292860f274ffba6f595 to your computer and use it in GitHub Desktop.
Expand region treesitter integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun treesit-mark-bigger-node () | |
(interactive) | |
(let* ((node (treesit-node-on (region-beginning) (region-end)))) | |
(let ((next-node (treesit-parent-until node (lambda (n) | |
(not (and | |
(= (region-beginning) (treesit-node-start n)) | |
(= (region-end) (treesit-node-end n)))))))) | |
(set-mark (treesit-node-end next-node)) | |
(goto-char (treesit-node-start next-node))))) | |
(defun er-use-treesit-expansions () | |
(setq-local er/try-expand-list '(er/mark-word treesit-mark-bigger-node))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment