Skip to content

Continuous Mode stopped after switching files #2996

@fhfuih

Description

@fhfuih

Description

I use VimTex with default configuration on compilation (there are some syntax configurations, but they shouldn't be related) on NeoVim. Whenever I switch to a new .tex file within the project folder, VimTex pauses with a message that the continuous mode is stopped. I wonder how it can be.

This may not be a VimTex issue, but probably I can get some help to start my debugging because I don't read Vimscript. (for example, when will VimTex decide to stop the continuous mode?) Also, maybe it helps identify compatibility issues for the neovim distro I use.

Steps to reproduce

Use AstroNvim distro. (Not sure if it really matters)

Use the following VimTex config

return {
  {
    "lervag/vimtex",
    ft = { "tex", "bib" },
    config = function()
      -- Highlight: use VimTeX, not TS.
      -- -- See *vimtex-faq-treesitter*
      -- -- Plus, current latex TS seems to not support expl3
      local g = vim.g
      -- Auto compile: use VimTeX, not LSP
      -- -- because my texlab sometimes detects wrong root file.
      -- -- And it will generate aux files for subfiles upon build.
      -- -- And there is subsequent undefined control sequences everywhere
      -- -- until I delete the wrong aux files
      -- -- This seems to be a recent problem though. Dunno why.
      -- -- I have also tried texlab.rootDirectory="." according to an issue. But no luck.
      vim.api.nvim_create_augroup("vimtex_config", {})
      vim.api.nvim_create_autocmd("User", {
        group = "vimtex_config",
        pattern = "VimtexEventInitPost",
        command = "VimtexCompile",
      })
      -- Auto view after compile: use VimTeX, not LSP
      -- -- It is related to what I use for auto compile
      -- -- Also, VimTeX can configure whether or not to give up window focus to PDF previewer
      if vim.fn.has "mac" then
        g.vimtex_view_method = "skim"
        g.vimtex_view_skim_sync = 1
        g.vimtex_view_skim_activate = 0
        g.vimtex_view_skim_reading_bar = 1
      end
      -- Diagnostic: use LSP, not VimTeX
      -- -- I can use a unified diagnostic view to see compilation errors and other lsp's outputs
      -- -- And also I hate it when a quickfix window popup when I am continuously building and writing
      g.vimtex_quickfix_enabled = 0
      -- Completion: use LSP, not VimTeX
      g.vimtex_complete_enabled = 0
      -- Fold: use VimTeX, not TS
      g.vimtex_fold_enabled = 1
      -- Configure conceals
      g.vimtex_syntax_conceal = {
        ligatures = 0,
        spacing = 0,
        sections = 1,
      }
      g.vimtex_syntax_conceal_cites = {
        ["type"] = "icon",
      }
      -- math mode imaps
      g.vimtex_imaps_leader = "@"
    end,
  },
}

Use the following test files

.
├── main.tex
└── sections
    └── section.tex
\documentclass{article}
\begin{document}
Hello world!
\input{sections/section.tex}
\end{document}
\textbf{something}

Open nvim with current directory at ., open sections/section.tex. VimTex should show a message that the compiler is started. Then switch to main.tex (I use Telescope and neotree)

Expected behavior

VimTex stays in continuous mode.

Actual behavior

VimTex stopped continuous mode. It echoes a message "Compiler Stopped (main.tex)"

Do you use a latexmkrc file?

No

VimtexInfo

System info:
  OS: macOS 13.2 (22D49)
  Vim version: NVIM v0.10.1
  Has clientserver: true
  Servername: /var/folders/6f/z0lqhhwd273d4_plbc4m5p000000gn/T/nvim.zeyu/4lA2zY/nvim.35251.0

VimTeX project: main
  base: main.tex
  root: /Users/zeyu/markups/test
  tex: /Users/zeyu/markups/test/main.tex
  main parser: recursive search
  document class: article
  source files:
    main.tex
    sections/section.tex
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
    job: 
      jobid: 6
      output: /var/folders/6f/z0lqhhwd273d4_plbc4m5p000000gn/T/nvim.zeyu/4lA2zY/0
      cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode  -pdf -pvc -pvctimeout- -view=none -e '$compiling_cmd = ($compiling_cmd ? $compiling_cmd . " ; " : "") . "echo vimtex_compiler_callback_compiling"' -e '$success_cmd = ($success_cmd ? $success_cmd . " ; " : "") . "echo vimtex_compiler_callback_success"' -e '$failure_cmd = ($failure_cmd ? $failure_cmd . " ; " : "") . "echo vimtex_compiler_callback_failure"' 'main.tex'
      pid: 0
  viewer: Skim

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions