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

Vimtex quickfix menu breaks snippet #1527

Open
kayprish opened this issue Mar 24, 2023 · 0 comments
Open

Vimtex quickfix menu breaks snippet #1527

kayprish opened this issue Mar 24, 2023 · 0 comments

Comments

@kayprish
Copy link

kayprish commented Mar 24, 2023

If one is currently typing out a snippet in a TeX file with UltiSnips, it will often stop working mid-writing if Vimtexs quickfix menu pops-up. The most common and annoying example is when writing using an environment snippet

Expected behavior:
When using a snippet such as this one:

snippet env "New environment" bA
\begin{$1}
	${0:${VISUAL:}}
\end{$1}
endsnippet

once you begin typing an environment, such as say, itemize, and jumping with JumpForwardTrigger, you get this:

\begin{itemize}
	"your cursor is now here"
\end{itemize}

and now you can continue typing in your snippet.

Actual behavior:
as you start to type, if the LaTeX document compiles in the meanwhile, it will likely produce an error, which will pop up in the quickfix menu below, after this, your snippet no longer works, what you type in the \begin{} is no longer reproduced in the \end{}, and you can no longer use the jump key to jump to the next tabstop. The end result is your text looking something like this:

\begin{itemize}
	
\end{ite}

the end command is broken and you have to reach down to fix it manually.

Steps to reproduce
In order for your file in Vimtex to compile after every edit, you need something like this in your vimrc:

autocmd TextChanged,InsertLeave *.tex silent update

Also, obviously, you need Vimtex installed for the continuous compilation, and, while you're editing, you need to turn continuous compilation on with "localleader" ll.

** Extra note **
It should be noted that this error will always happen when you start writing an environment, because at some point while you're writing you will have an environment name such as ite, which is incomplete, and LaTeX will complain that this environment doesn't exist.

** Workarounds **

  • Disable the autocmd line in your vimrc, so the LaTeX file compiles only when you explicitly ":w" it.
  • Completely disable quickfix error messages, but this is a problem, because you can't see if something is wrong with your file
  • Type the environment name really, really, really, faaast, so the compilation error doesn't have time to happen

  • Operating System: Artix Linux
  • Vim Version: 9.0 Included patches 1-1337
  • UltiSnips Version: 3.2 current commit: 0ad238b
  • Python inside Vim: 3.10.9
  • Docker repo/vimrc: the vimrc and ftplugin/tex.vim needed to reproduce the bug are small enough for me to include them here:
    vimrc:
call plug#begin('~/.vim/plugged')

Plug 'lervag/vimtex'
Plug 'SirVer/ultisnips'

let g:UltiSnipsSnippetDirectories = [$HOME.'/.vim/UltiSnips']
call plug#end()

autocmd TextChanged,InsertLeave *.tex silent update

ftplugin/tex.vim:

let g:vimtex_quickfix_mode = 2
let g:vimtex_quickfix_open_on_warning = 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant