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:
parent
c0637e9e00
commit
cb269deed6
2 changed files with 11 additions and 8 deletions
|
@ -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=)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue