feat(tree-sitter): add function call text object

Changes:
- Bind `F` to the function call text object
- Add the text object to the table
- Realign table so it looks right to people who don't hide emphasis
markers
This commit is contained in:
Jeetaditya Chatterjee 2021-09-21 19:40:00 +01:00
parent c0637e9e00
commit cb269deed6
No known key found for this signature in database
GPG key ID: 09D54CECD2132B91
2 changed files with 11 additions and 8 deletions

View file

@ -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=)

View file

@ -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