nvim-treesitter / nvim-treesitter/nvim-treesitter-textobjects
Add documentation.inner / documentation.outer as text objects
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.
I'd like to be able to use did and dad to delete the inner and outer docstring of various languages.
Now that treesitter supports documentation capture groups it'd be great if nvim-treesitter-textobjects could follow suit.
Describe the solution you'd like
I have a fork of this repo where I've implemented one for Python. I can contribute that as a PR, if you're up for it.
Describe alternatives you've considered
None.
Additional context
Here's a GIF showing the fork I've been using so far. Seems to be working.
dad

did

Using configuration
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
-- ...
keymaps = {
["ad"] = {
desc = "Select around an entire docstring",
query = "@documentation.outer",
},
["id"] = {
desc = "Select the inside of a docstring",
query = "@documentation.inner",
},
-- ...
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
No repository file or test is named. Start with the select.keymaps configuration in the issue and compare the fork's Python implementation with Tree-sitter's documentation capture groups. Done means did and dad can select the inner and outer docstring through @documentation.inner and @documentation.outer for the intended languages.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, neovim
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100