Skip to content

Unsetting g:vimtex_view_forward_search_on_start results in zathura being opened twice #1775

@donbex

Description

@donbex

Issue
Setting g:vimtex_view_forward_search_on_start = 0 and starting latexmk via <plug>(vimtex-compile-toggle) results in zathura being opened twice. I haven't tested this with another viewer.

minimal.vim

set nocompatible
let &runtimepath  = '~/.vim/bundle/vimtex,' . &runtimepath
let &runtimepath .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable
let g:vimtex_view_forward_search_on_start = 0
let g:vimtex_view_method = 'zathura'

minimal.tex

\documentclass{minimal}
\begin{document}
Hello world!
\end{document}

Commands/Input
After starting nvim, run latexmk via \ll.

Observed Behaviour
A zathura window is opened, the terminal running nvim flashes while latexmk is running, then a second zathura window is opened.

Expected Behaviour
Only one zathura window is opened.

Note
When g:vimtex_view_forward_search_on_start is set to 1, \ll first opens a zathura window, then shows the synctex location after the first compilation is finished. This leads me to believe that zathura is called twice in both cases.

Update
g:vimtex_view_forward_search_on_start = 0 also appears to break normal forward search via \lv.

Output from VimtexInfo

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

vimtex project: minimal
  base: minimal.tex
  root: /tmp/vimtex
  tex: /tmp/vimtex/minimal.tex
  out: /tmp/vimtex/minimal.pdf
  log: /tmp/vimtex/minimal.log
  aux: /tmp/vimtex/minimal.aux
  fls: /tmp/vimtex/minimal.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
    job: 3
    pid: 91938
    cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -e '$new_viewer_always = "0"' -e '$pdf_previewer = "zathura  -x \"nvr --servername /tmp/nvimUjrwO1/0 --remote +\%{line} \%{input}\" \%S"' -e '$success_cmd = "echo vimtex_compiler_callback_success"' -e '$failure_cmd = "echo vimtex_compiler_callback_failure"' 'minimal.tex'
  viewer: Zathura
    xwin id: 10485763
    process: 
      pid: -
      cmd: zathura -x "nvr --servername /tmp/nvimUjrwO1/0 --remote-expr \"vimtex#view#reverse_goto(%{line}, '%{input}')\""  '/tmp/vimtex/minimal.pdf' >/dev/null 2>&1 &
  qf: LaTeX logfile
    config: 
      packages: 
        default: 1
      default: 1
  document class: minimal

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions