2

I use text objects with evil like "i(" for the contents of the brackets. I would quite like "magic code aware text objects"?

This textobject would:

  • return the entire function if I was at a function
  • return the entire class if I was at a class
  • return the switch if I was at an "if/elif" block

etc.

Is there a way to do this task that does not consist of completely implementing it myself?

Att Righ
  • 725
  • 4
  • 14

1 Answers1

2

May be https://github.com/meain/evil-textobj-tree-sitter can fit your need.

Take a look at Doom Emacs' tree-sitter module config for examples.

But if you need something so DWIMmy instead of vi's preferred explicit approach, IMO tree-sitter & expand-region : tree-sitter-mark-bigger-node should be more appropriate for you.

Daanturo
  • 180
  • 8