docs(tree-sitter): add rebinding keys section

This commit is contained in:
Jeetaditya Chatterjee 2022-04-10 18:13:20 +01:00
parent def8c05371
commit 65207ab3dc
No known key found for this signature in database
GPG key ID: 09D54CECD2132B91

View file

@ -15,6 +15,7 @@
- [[#goto-certain-nodes][Goto certain nodes]]
- [[#configuration][Configuration]]
- [[#disable-text-objects-for-certain-modes][Disable text objects for certain modes]]
- [[#rebinding-text-objects][Rebinding text objects]]
- [[#adding-your-own-text-objects][Adding your own text objects]]
- [[#disabling-highlighting-for-certain-modes][Disabling highlighting for certain modes]]
- [[#troubleshooting][Troubleshooting]]
@ -85,6 +86,23 @@ want it for ruby we would use this snippet
(remove-hook 'ruby-mode-hook #'+tree-sitter-keys-mode)
#+end_src
** Rebinding text objects
Rebinding keys is the same as any other key but do notes they need to be bound
to the keymaps ~+tree-sitter-inner-text-object-map~ or
~+tree-sitter-outer-text-object-map~
#+begin_src emacs-lisp
(map! (:map +tree-sitter-outer-text-objects-map
"f" nil
"f" (evil-textobj-tree-sitter-get-textobj "call.inner")
"F" nil
"F" (evil-textobj-tree-sitter-get-textobj "function.inner"))
(:map +tree-sitter-inner-text-objects-map
"f" nil
"f" (evil-textobj-tree-sitter-get-textobj "call.inner")
"F" nil
"F" (evil-textobj-tree-sitter-get-textobj "function.inner")))
#+end_src
** Adding your own text objects
If you wish to [[https://github.com/meain/evil-textobj-tree-sitter#custom-textobjects][add your own custom text objects]] then you need to bind them and
add them to the ~+tree-sitter-{inner, outer}-text-objects-map~