]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(context): fix issue with SyncTeX and update command
authorLifepillar <lifepillar@lifepillar.me>
Wed, 4 Feb 2026 16:31:05 +0000 (16:31 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 4 Feb 2026 16:31:05 +0000 (16:31 +0000)
Remove `--nonstopmode` because (a) ConTeXt always stops anyway, and (b)
`--nonstopmode` disables SyncTeX unconditionally. Add `--paranoid`,
which prevents the command to descend to `..` and `../..`.

Pass the typesetting command only the name of the input file rather than
its full path, as that is more compatible with ConTeXt's syncing
mechanism.

closes: #19323

Signed-off-by: Lifepillar <lifepillar@lifepillar.me>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/autoload/context.vim
runtime/autoload/typeset.vim

index df418bf139dd307f205375d7bff1a418a816d091..5736406a8d243de04a44e26a7ec26edfabcbbf72 100644 (file)
@@ -3,13 +3,13 @@ vim9script
 # Language:           ConTeXt typesetting engine
 # Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
 # Former Maintainers: Nikolai Weibull <now@bitwi.se>
-# Latest Revision:    2026 Jan 10
+# Latest Revision:    2026 Feb 03
 
 # Typesetting {{{
 import autoload './typeset.vim'
 
 export def ConTeXtCmd(path: string): list<string>
-  var cmd = ['mtxrun', '--script', 'context', '--nonstopmode', '--autogenerate']
+  var cmd = ['mtxrun', '--script', 'context', '--paranoid', '--autogenerate']
   if !empty(get(g:, 'context_extra_options', ''))
     cmd += g:context_extra_options
   endif
index ed808a817e80c02c1a044e36b6a544cb5d2b0a32..aba84746589517a997bcb1e2439a025724f1b749 100644 (file)
@@ -2,7 +2,7 @@ vim9script
 
 # Language:           Generic TeX typesetting engine
 # Maintainer:         Nicola Vitacolonna <nvitacolonna@gmail.com>
-# Latest Revision:    2026 Jan 10
+# Latest Revision:    2026 Feb 03
 
 # Constants and helpers {{{
 const SLASH = !exists("+shellslash") || &shellslash ? '/' : '\'
@@ -203,6 +203,7 @@ export def Typeset(
     env:   dict<string> = {}
     ): bool
   var fp   = fnamemodify(path, ':p')
+  var name = fnamemodify(fp, ':t')
   var wd   = fnamemodify(fp, ':h')
   var qfid = NewQuickfixList(fp)
 
@@ -216,7 +217,11 @@ export def Typeset(
     return false
   endif
 
-  var jobid = job_start(Cmd(path), {
+  # Make sure to pass only the base name of the path to Cmd as this usually
+  # works better with TeX commands (note that the command is executed inside
+  # the file's directory). For instance, ConTeXt writes the path in .synctex
+  # files, and full paths break syncing from the editor to the viewer.
+  var jobid = job_start(Cmd(name), {
     env: env,
     cwd: wd,
     in_io: "null",