Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not kill viewer sioyek when exiting vim #2401

Closed
kiryph opened this issue May 26, 2022 · 5 comments
Closed

Do not kill viewer sioyek when exiting vim #2401

kiryph opened this issue May 26, 2022 · 5 comments
Labels

Comments

@kiryph
Copy link
Contributor

kiryph commented May 26, 2022

Description

The pdf viewer sioyek recently introduced the possibility to open several windows per instance in commits ahrm/sioyek@8096178 and ahrm/sioyek@2c508f5 .

When I open a tex file with vimtex and view it in the current instance and then exit neovim, the single sioyek instance with all opened pdf files is closed.

Steps to reproduce

  1. nvim -u minimal.vim minimal.tex
  2. compile pdf
  3. open pdf viewer sioyek from vimtex
  4. exit neovim

Expected behavior

Only close the corresponding sioyek window. If this is currently not possible, just leave sioyek running also with the pdf belonging to the tex file.

Actual behavior

Sioyek instance with all opened pdf files is closed.

Do you use a latexmkrc file?

no

VimtexInfo

System info:
  OS: macOS 11.6.5 (20G527)
  Vim version: NVIM v0.8.0-dev+1527-g521e91e1c
  Has clientserver: true
  Servername: /var/folders/2z/bljkcy1j2cbf7l9zf3dk0nqc0000gn/T/nvimX1b6QN/0

VimTeX project: mueller-2013-fig-11.5
  base: mueller-2013-fig-11.5.tex
  root: /Users/kiryph/Projects/LaTeX/gu-4th-5th-steps
  tex: /Users/kiryph/Projects/LaTeX/gu-4th-5th-steps/mueller-2013-fig-11.5.tex
  main parser: current file
  document class: standalone
  packages: amsbsy amsgen amsmath amsopn amstext array calc chemgreek defpattern epstopdf-base expl3 fp fp-addons fp-basic fp-eqn fp-eval fp-exp fp-pas fp-random fp-snap fp-trigo fp-upn graphics graphicx gu ifluatex iftex ifthen keyval l3keys2e mhchem pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfrcs pgfsys pict2e preview shellesc tabularx tikz trig xcolor xkeyval xparse
  compiler: latexmk
    engine: -pdf
    options:
      -verbose
      -file-line-error
      -synctex=1
      -interaction=nonstopmode
    callback: 1
    continuous: 1
    executable: latexmk
  viewer: sioyek
    job: 
      pid: 55360
      cmd: /Applications/sioyek.app/Contents/MacOS/sioyek --new-window  --inverse-search "/usr/local/bin/nvim --headless -c \"VimtexInverseSearch %2 '%1'\"" --forward-search-file '/Users/kiryph/Projects/LaTeX/gu-4th-5th-steps/mueller-2013-fig-11.5.tex' --forward-search-line 1 '/Users/kiryph/Projects/LaTeX/gu-4th-5th-steps/mueller-2013-fig-11.5.pdf'
    cmd_start: /Applications/sioyek.app/Contents/MacOS/sioyek --new-window  --inverse-search "/usr/local/bin/nvim --headless -c \"VimtexInverseSearch %2 '%1'\"" --forward-search-file '/Users/kiryph/Projects/LaTeX/gu-4th-5th-steps/mueller-2013-fig-11.5.tex' --forward-search-line 1 '/Users/kiryph/Projects/LaTeX/gu-4th-5th-steps/mueller-2013-fig-11.5.pdf'
  qf method: LaTeX logfile

Minimal ~/.config/nvim/init.lua

vim.g.vimtex_view_method = 'sioyek'
vim.g.vimtex_view_sioyek_exe = '/Applications/sioyek.app/Contents/MacOS/sioyek'

minimal.tex

\documentclass{minimal}
\begin{document}
Hello world!
\end{document}
@kiryph kiryph added the bug label May 26, 2022
@lervag
Copy link
Owner

lervag commented May 28, 2022

I believe this is because the process is not detached. I.e., here:

let self.job = jobstart(self.cmd, l:options)

I should probably add detach = true to the jobstart options. Not sure if there may be unexpected consequences of this, though.

lervag added a commit that referenced this issue May 28, 2022
@lervag
Copy link
Owner

lervag commented May 28, 2022

I made a slightly conservative update that I believes fixes your issue. Please test.

@lervag lervag closed this as completed May 28, 2022
@lervag
Copy link
Owner

lervag commented May 28, 2022

Conservative, as in I only use the detached flag where it seems natural via opt-in.

@kiryph
Copy link
Contributor Author

kiryph commented May 29, 2022

Yes, the windows remain open now, when I close neovim with tex file. Thank you.

When I find the time, I will talk to the author of sioyek whether there can be a method to close only the corresponding window.
But for now I am happy with this.

lervag added a commit that referenced this issue May 24, 2023
lervag added a commit that referenced this issue Jun 8, 2023
lervag added a commit that referenced this issue Jun 8, 2023
This is because, for some reason, detaching leads to a popup command
window that is annoying to users.

refer: #2401, #2627, #2706, #2717
@lervag
Copy link
Owner

lervag commented Jun 8, 2023

For reference: #2717 reverts this change for Windows users with the general viewer. The main context for this change is from #2706.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants