Skip to content

Custom syntax cmd gets overwritten on package detection #2629

@lostgeek

Description

@lostgeek

Description

Custom syntax command for concealment breaks after vimtex detects the packages containing those commands.

Steps to reproduce

minimal.vim

set nocompatible
set runtimepath^=~/.vim/bundle/vimtex
set runtimepath+=~/.vim/bundle/vimtex/after
filetype plugin indent on
syntax enable

let g:vimtex_syntax_custom_cmds = [
      \ {'name': 'ch', 'mathmode': 0, 'argspell': 0, 'argstyle':'bold', 'conceal':1},
      \ {'name': 'qty', 'mathmode': 0, 'argspell': 0, 'argstyle':'bold', 'arggreedy':1, 'conceal':1},
      \]

minimal.tex

\documentclass[12pt]{article}

% \usepackage{chemformula}
% \usepackage{siunitx}

\begin{document}
\section*{Example}

\begin{itemize}
    \item asdf
\end{itemize}

\ch{C2H2}

\qty{1}{\metre}

\end{document}
  1. Open Vim with vim -u minimal.vim minimal.tex
  2. Uncomment imports
  3. Start compilation via <leader>ll
  4. Observe custom conceal of \ch and \qty commands before and after compilation

Expected behavior

The custom conceal commands to work both before and after package detection.

Actual behavior

The custom conceal commands break when packages chemformula and siunitx are detected.

Do you use a latexmkrc file?

No

VimtexInfo

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

VimTeX project: example
  base: example.tex
  root: /home/lostgeek/temp
  tex: /home/lostgeek/temp/minimal.tex
  main parser: current file verified
  document class: article
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    build_dir: build
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: Zathura
    xwin id: 0
  qf method: LaTeX logfile


% After compilation:
  packages: amsbsy amsgen amsmath amsopn amstext array chemformula color epstopdf-base etoolbox expl3 graphics graphicx iftex ifthen infwarerr keyval l3keys2e ltxcmds nicefrac pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfrcs pgfsys siunitx textcomp tikz translations trig xcolor xfrac xparse xtemplate

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions