Skip to content

Wrong commentstring in nested LaTeX file #2100

@NicolaiRuckel

Description

@NicolaiRuckel

Issue
When using a dockerfile in a LaTeX llisting, commentstring gets set to # %s while Vim still detects the filetype as being tex.

minimal.tex

Create the following document as main.tex:

\documentclass{article}

\usepackage{listings}
\usepackage{minted}

\usemintedstyle{borland}

\setminted{%
  autogobble,
  xleftmargin=20pt,
  linenos
}

\begin{document}

\begin{listing}[ht]
  \begin{minted}{dockerfile}
  FROM java:8
  ADD example-app-1.0.jar app.jar
  EXPOSE 8761
  ENTRYPOINT ["java", "-jar", "/app.jar"]
  \end{minted}
  \caption{Simple \texttt{Dockerfile} example.}
  \label{lst:example-docker}
\end{listing}
\end{document}

Running :verbose set commentstring gives the following output:

commentstring=# %s
      Last set from /usr/share/nvim/runtime/syntax/dockerfile.vim line 38

Output from VimtexInfo
Run :VimtexInfo and paste the content here.

System info
  OS: Arch Linux
  Vim version: NVIM v0.5.0
  Has clientserver: true
  Servername: /tmp/nvimMERncM/0

VimTeX project: text
  base: text.tex
  root: /home/nicolai/tmp
  tex: /home/nicolai/tmp/text.tex
  out: 
  log: 
  aux: 
  fls: 
  main parser: current file verified
  compiler: latexmk
    configuration: 
      continuous: 1
      callback: 1
      latexmk options:
        -verbose
        -file-line-error
        -synctex=1
        -interaction=nonstopmode
      latexmk engine: -pdf
  viewer: General
  qf: LaTeX logfile
    addqflist: 52
    fix_paths: 53
    set_errorformat: 51
  document class: article
  packages:
    listings
    minted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions