Skip to content

Folding interaction with commented command definitions #2668

@ji-cerny

Description

@ji-cerny

Description

When using foldmethod=expr, folding (in particular in the preamble) breaks when the file contains lines like

%\newcommand{\Pt}{\tilde{\mathbb{P}}}

vimtex#fold#level() function returns s1 for such lines, since they match the regular expression for the fold-end marker %.*}}}, as defined in autoload/vimtex/fold/markers.vim

While debugging this, I also found that there is probably a typo in autoload/vimtex/fold/markers.vim in function s:folder_level(), where self should be used instead of s:self. Otherwise the vimtex#fold#level() actually finishes with error and returns -1

Steps to reproduce

No response

Expected behavior

No response

Actual behavior

No response

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: Linux 6.1.15-200.fc37.x86_64
  Vim version: VIM 9.0 (1-1367)
  Has clientserver: true
  Servername: VIM

VimTeX project: gproc
  base: bla.tex
  root: /home/xxx/foo
  tex: /home/xxx/foo/bla.tex
  main parser: current file verified
  document class: scrbook
  packages: amsbsy amsfonts amsgen amsmath amsopn amssymb amstext amsthm atbegshi atbegshi-ltx atveryend atveryend-ltx auxhook babel bigintcalc bitset bookmark calc caption caption3 changebar color enumitem epstopdf-base etexcmds etoolbox expl3 fontenc footmisc geometry gettitlestring graphics graphicx hycolor hyperref ifmtarg iftex ifthen ifvtex infwarerr inputenc intcalc keyval kvdefinekeys kvoptions kvsetkeys letltxmacro ltxcmds makeidx marginnote mathtools mhsetup nameref pdfescape pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfrcs pgfsys refcount rerunfilecheck scrbase scrkbase scrlayer scrlayer-scrpage scrlfile scrlfile-hook scrlogo tikz tocbasic trig typearea uniquecounter url verbatim xcolor xifthen xparse xparse-2020-10-01 xpatch
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    job: 
      jobid: process 32563 dead
      output: /tmp/vN3cqSx/0
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf 'bla.tex'
      pid: 32563
  viewer: General
  qf method: LaTeX logfile

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions