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

Change Surrounding Environment Error when Exclamation Point in Environment Name #2334

Closed
ZaydH opened this issue Feb 19, 2022 · 4 comments
Closed
Labels

Comments

@ZaydH
Copy link

ZaydH commented Feb 19, 2022

Description

Change the surrounding environment command cse can change the wrong \end block when the current environment has an exclamation point in the name. Packages like optidef use an exclamation point in some environment names.

Steps to reproduce

Initial Step: nv -u minimal.vim minimal.tex

In the code LaTeX file below, I put my cursor inside the curly brackets for the line \begin{mini!}. In vim command mode, I press cse and type maxi! (or maxi does not matter).

MWE:

minimal.tex

\documentclass[10pt]{article}

\usepackage{optidef}

\begin{document}
  \begin{mini!}
    {w}{z}{}{}
    \addConstraint{X}
  \end{mini!}
\end{document}

minimal.vim (Uses vim-plug not vundle) but just loads vimtex

" =========================================================================
"     vim-plug Start
" =========================================================================

" Autoinstall vim-plug if it doesn't exist
if empty(glob('~/.vim/autoload/plug.vim'))
  silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()

Plug 'lervag/vimtex'

" All of your Plugins must be added before the following line
call plug#end()

Expected behavior

The begin/end environment block should both change to the new environment name I specify.

Actual behavior

The begin environment block changes as expected. Instead of changing the end environment block, the \end{document} block is changed.

If the environment name does not have the ! (exclamation point), this issue is not observed.

Do you use a latexmkrc file?

Yes but not relevant since not in build mode.

VimtexInfo

System info:
  OS: Pop!_OS 21.10
  Vim version: NVIM v0.4.4
  Has clientserver: true
  Servername: /tmp/nvim8dvTvv/0
  
VimTeX project: minimal
  base: minimal.tex  
  root: /home/zayd/repos/uo_docs/notes/bpu_teaching
  tex: /home/zayd/repos/uo_docs/notes/bpu_teaching/minimal.tex
  main parser: current file verified
  document class: article
  packages: optidef
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: General
  qf method: LaTeX logfile
@ZaydH ZaydH added the bug label Feb 19, 2022
@ZaydH
Copy link
Author

ZaydH commented Feb 19, 2022

In case it is useful, the optidef package manual showing the various environment formats.

lervag added a commit that referenced this issue Feb 19, 2022
@lervag
Copy link
Owner

lervag commented Feb 19, 2022

Fascinating. I was not aware there were any environment names with exclamation marks.

Your issue should be fixed now.

@lervag lervag closed this as completed Feb 19, 2022
@ZaydH
Copy link
Author

ZaydH commented Feb 20, 2022

Confirmed. Thank you!

@lervag
Copy link
Owner

lervag commented Feb 20, 2022

Great, glad to hear it!

This issue was closed.
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