I'm using vim to edit LaTeX code, and I'm often writing intervals like (a,b]
but this messes with other vim features. For instance,
- Jumping with %: if I have something like
\phi((a,b])
, the final)
will match the second(
and some closing parenthesis later in the code will match the first. - There's a feature (I'm not sure if it's specific to vimtex or just a feature of vim) where ]] closes any open delimiters, and this makes that behave wrongly - it'll try to close the
)
from many lines ago. - The tsd/csd/dsd features of vimtex which toggle/change/delete surrounding delimiters don't work (I think csd and dsd are extensions of vim-surround but I'm not sure). In particular, either they select the wrong delimiters or do nothing at all.
Currently I'm putting )
s in comments to mitigate this. This solves the problem of parentheses later in the file matching wrongly, but matching in the same line doesn't work (and things like tsd
from vimtex don't work properly).
Is there any better solution, or a standard solution for this kind of problem? Ideally this would deal with [a,b)
also.
\DeclarePairedDelimiter
command from the mathtools package to then just write like\leftopenint{a, b}
. I learned about this in this question