nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
Allow multiple queries for `select` to increase configurability
Nobody has claimed this yet.
- Dominant language
- Tree-sitter Query
- Stars
- 2.8k
- Forks
- 271
- Avg merge
- 8d 8h
- Merged PRs (30d)
- 1
Description
Is your feature request related to a problem? Please describe.
Some select text objects I don't want to map to their own individual keys and would rather just take the first one available from a list of queries.
Describe the solution you'd like
Similar to the move and swap text objects, it would be amazing to supply regex or a list of queries to a select text object. That way we can bind several queries easily to a single keymap.
Describe alternatives you've considered
I'm not sure if there is any other alternative other than just mapping each query to it's own mapping
Additional context
I'm curious if there is an architectural limitation that kept this from being implemented in the first place when multiple query support was added to move and swap. Plugins like mini.ai have support for utilitizing the nvim-treesitter-textobjects queries to construct select mappings with multiple queries which leads me to believe it should be doable here as well.
Thanks so much for everyone's work here maintaining and developing this plugin, it is a godsend!
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
Locate the select, move, and swap text-object implementations and compare their handling of multiple queries. Determine how a regex or query list should make select choose the first available match, then add coverage for the requested single-key mapping behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, neovim
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100