vimtex icon indicating copy to clipboard operation
vimtex copied to clipboard

Please don't force user to select a main file!

Open goulf-3m opened this issue 10 months ago • 4 comments

Description

When I vim x.tex to create a new tex file that is meant to be a main file itself, the prompt of selecting a main file makes no sense. But it seems that I cannot cancel the prompt. Please provide a cancel option and enter single-file mode.

BTW, is there a way to relax this mode that a tex file has a main file? A tex file can have multiple main files, or no main file! For example, a .bib file shared by multiple documents.

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

No

VimtexInfo

I have vimtex ac0a41b, but I cannot run :VimtexInfo...
Actually, in this scenario, there is no relevant latex file.

goulf-3m avatar Apr 20 '24 09:04 goulf-3m

When I vim x.tex to create a new tex file that is meant to be a main file itself, the prompt of selecting a main file makes no sense. But it seems that I cannot cancel the prompt. Please provide a cancel option and enter single-file mode.

The prompt is only there if there are several "possible" main files in the directory. But I agree, it should be possible to cancel the prompt. I'll look at it when I get the time.

BTW, is there a way to relax this mode that a tex file has a main file?

Create your new file in a new directory.

I have vimtex ac0a41b, but I cannot run :VimtexInfo... Actually, in this scenario, there is no relevant latex file.

:VimtexInfo is available when VimTeX is loaded, i.e. for tex files. The point of showing it is because I want to see some system information from your side so that I don't have to ask for it when it is relevant.

lervag avatar Apr 20 '24 10:04 lervag

Please provide a minimal example for your problem. I'll make a quick fix for this when I have the example with the steps necessary to reproduce the problem.

lervag avatar Apr 20 '24 11:04 lervag

VimtexInfo:

System info:
  OS: Arch Linux
  Vim version: NVIM v0.9.5
  Has clientserver: true
  Servername: /run/user/1000/nvim.86561.0

VimTeX project: art
  base: art.tex
  root: /tmp/eg
  tex: /tmp/eg/art.tex
  main parser: current file verified
  document class: article
  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

A minimal example is shown below. I might want to keep these files in one directory, as they are in a single project. If I nvim lit.bib, the prompt will be annoying.

lit.bib

@misc{vaswani_attention_2023,
  title         = {Attention {Is} {All} {You} {Need}},
}

pres.tex

\documentclass{beamer}
\begin{document}
\begin{frame}
    Hello\cite{vaswani_attention_2023}
\end{frame}
\begin{frame}
    \bibliographystyle{plain}
   \bibliography{lit.bib}
\end{frame}
\end{document}

art.tex

\documentclass{article}
\begin{document}
Hello\cite{vaswani_attention_2023}
\bibliographystyle{plain}
\bibliography{lit.bib}
\end{document}

goulf-3m avatar May 02 '24 11:05 goulf-3m

Thanks for the example; I've implemented a suggestion for this now. Please test and let me know what you think.

lervag avatar May 02 '24 15:05 lervag