diff --git a/modules/tools/tree-sitter/README.org b/modules/tools/tree-sitter/README.org index 4ab0a623e..988467a4d 100644 --- a/modules/tools/tree-sitter/README.org +++ b/modules/tools/tree-sitter/README.org @@ -57,13 +57,14 @@ Not all language support all text objects (yet). [[https://github.com/nvim-trees objects languages support]] Note: only languages with parsers in emacs have text object support currently. Currently text objects are bound to: -| key | text object | -|-----+-------------| -| =f= | function | -| =C= | class | -| =c= | comment | -| =i= | conditional | -| =l= | loop | +| key | text object | +|-----+---------------------| +| =f= | function definition | +| =F= | function call | +| =C= | class | +| =c= | comment | +| =i= | conditional | +| =l= | loop | They are used in a container context (not =vf= but =vaf= or =vif=) diff --git a/modules/tools/tree-sitter/config.el b/modules/tools/tree-sitter/config.el index ed9ae8239..8176b82cc 100644 --- a/modules/tools/tree-sitter/config.el +++ b/modules/tools/tree-sitter/config.el @@ -1,7 +1,6 @@ ;;; tools/tree-sitter/config.el -*- lexical-binding: t; -*- (use-package! tree-sitter - :when (bound-and-true-p module-file-suffix) :hook (prog-mode . turn-on-tree-sitter-mode) :hook (tree-sitter-after-on . tree-sitter-hl-mode) :config @@ -16,10 +15,13 @@ (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