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

Delimited textobj when set selection=exclusive #2368

Closed
patnr opened this issue Apr 7, 2022 · 4 comments
Closed

Delimited textobj when set selection=exclusive #2368

patnr opened this issue Apr 7, 2022 · 4 comments
Labels

Comments

@patnr
Copy link
Contributor

patnr commented Apr 7, 2022

Like always, thanks for the great work. I recently discovered the option

set selection=exclusive

which doesn't include the last char in a selection, useful to avoid selecting the end-of-line character. But now when I use vimtex's delimited textobj's (e.g. da$) the trailing $ is not deleted. This also applies for d delimiters but not e. I believe this is a bug. Related issue/fix from vim-textobj-user

@patnr patnr added the bug label Apr 7, 2022
@lervag
Copy link
Owner

lervag commented Apr 10, 2022

Thanks for the kind words and for the interesting issue. Could you please provide a couple of detailed examples, e.g. something along the lines of this:

text $inline| math$ other text
% dap from |
Expect:  text other text
Observe: text $ other text

This will help me understand what you see and what you expect and will greatly help in fixing the issue.

@lervag
Copy link
Owner

lervag commented Apr 10, 2022

For my personal reference (so I don't have to look it up), the referred to solution from vim-textobj-user is to add this:

if &selection ==# 'exclusive'
  normal! l
endif

@patnr
Copy link
Contributor Author

patnr commented Apr 10, 2022

You provide one example there, except I'm referring to da$, not dap. Also di$ leaves $h$ rather than $$

Similarly, doing dad inside the brackets leaves the trailing ] below. Same happens for parentheses.

text $[abc def]$ other text

lervag added a commit that referenced this issue Apr 25, 2022
@lervag
Copy link
Owner

lervag commented Apr 25, 2022

I've pushed a fix now. Please let me know if you have more similar examples.

@lervag lervag closed this as completed Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants