Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Textobj: item in list seperated with "," or similar #60

Open
3 tasks done
gerazov opened this issue Nov 6, 2023 · 2 comments
Open
3 tasks done

New Textobj: item in list seperated with "," or similar #60

gerazov opened this issue Nov 6, 2023 · 2 comments

Comments

@gerazov
Copy link

gerazov commented Nov 6, 2023

Textobj requested

Select item in a list of items separated with , . Although treesitter parsers already do this for code (#58) via the in argument mechanic nvim-treesitter-textobjects, it would be useful to have it for lists in pure text, e.g.

This is a list of items in: rst, md, txt, text, mail files. 

Also could come in handy for comments in code scripts that list stuff.

The syntax would be i<separator> for inner and a<separator> for outer. Here <separator> can be ,, ;, ...

Inner/Outer Difference

In it's simplest use-case - inner i, would not take the separator, and around a, would e.g. if your cursor is on text then:

This is a list of items in: rst, md, txt, text, mail files. 
                                          |--| inner
                                outer   |----|

Edge cases would be the first element:

  • the right bound is the ,
  • the left bound:
    • if there is a : or - starting the list than it is taken as a bound of the first item,
    • if not then the first item could be a single word.

And for the last element:

  • the right bound is the .
  • the left bound:
    • the and if there is one
    • the previous ,

Vimscript plugin already implementing the textobj

https://github.com/wellle/targets.vim

Filetypes

all

Checklist

  • The textobj would be useful to more users than just me.
  • There is no lua plugin already implementing the textobj in an adequate manner.
  • I read the docs and there is no such textobj already.
Copy link

github-actions bot commented May 4, 2024

This issue has been automatically marked as stale.
If this issue is still affecting you, please leave any comment, for example "bump", and it will be kept open.

@github-actions github-actions bot added the Stale label May 4, 2024
@bew
Copy link

bew commented May 4, 2024

Bump 🙏

@github-actions github-actions bot removed the Stale label May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants