nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
Motion around node
Nobody has claimed this yet.
- Dominant language
- Tree-sitter Query
- Stars
- 2.8k
- Forks
- 271
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 1
Description
It would be very convenient to have in addition to init_selection a similar command that works in operator-pending mode, i.e., something like "around node" or "an", so that one can use "dan", "yan" etc.
Currently the same functionality can be done by first invoking the init_selection and then using the operator, but in my opinion around operator can be useful as well. There is also a treesitter-textobjects, that allows around motions, but only for selected tags in selected languages, whereas "around node" should be quite general.
I have tried to use the public api of treesitter to write this functionality, but failed, perhaps due to my lack of knowledge. If there is a way, maybe it can be added to the documentation, and if not I believe that this can easily be done using the inner workings of nvim-treesitter.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing init_selection behavior and the public Tree-sitter API, then compare it with the inner workings of nvim-treesitter-textobjects. Determine how an around-node motion should work in operator-pending mode and verify that commands such as dan and yan provide the requested behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- neovim
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100