Skip to content

tsd should only happen inside one math region #3024

@ces42

Description

@ces42

Description

The behavior of tsd can be improved I think.

Steps to reproduce

Consider the following snippet

An interval like
%
\begin{equation}
	I = (0, 1]
\end{equation}
%
is called half-open, just like the interval
\[
	J = [0, 1)
\]

I you tsd while the cursor is on either zero, or even if the cursor is on the work just, vimtex will add \left to the ( in the equation environment and \right to the ) in the displaymath. This will throw a compile error.

Expected behavior

Nothing should happen in either of these situations. (While it would be cool if vimtex could toggle \left-\right for interval notation this would be very hard and error-prone).
Essentially tsd should only work when the cursor is in a math zone, and it should only look for delimiters in that math zone.

Actual behavior

No response

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Ubuntu 23.10
  Vim version: NVIM v0.11.0-dev-650+ge961627956
  Has clientserver: true
  Servername: /run/user/1000/nvim.1178919.0

VimTeX project: tex
  base: tex.tex
  root: /home/ca/vim
  tex: /home/ca/vim/tex.tex
  main parser: current file verified
  document class: article
  packages: amsbsy amsfonts amsgen amsmath amsopn amstext
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: Zathura
    xwin id: 0
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions