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

Sioyek viewer --reuse-instance #2468

Closed
rrueger opened this issue Aug 23, 2022 · 4 comments
Closed

Sioyek viewer --reuse-instance #2468

rrueger opened this issue Aug 23, 2022 · 4 comments

Comments

@rrueger
Copy link

rrueger commented Aug 23, 2022

The default vimtex Sioyek viewer options automatically pass --reuse-instance to Sioyek.

In this issue I argue that this option should be removed and a g:vimtex_view_sioyek_options string should be introduced similar to g:vimtex_view_zathura_options.

What happens when --reuse-instance is passed?

Every document that is opened in VimTeX will open in the same Sioyek window. If one opens two documents in VimTeX, then one cannot see both of the pdfs at the same time. Even worse, if one already has a pdf open independently of VimTeX, VimTeX will "hijack" that window and replace its contents.

What happens when --reuse-instance is not passed?

VimTeX spawns a new Sioyek instance for each document and all associated behvaiour is as expected. Despite the --reuse-instance option not being passed, when one edits a file the pdf refreshes within the same window, and when one searches with \lv VimTeX searches within the same Sioyek window. In both cases, VimTeX does not launch a new Sioyek window. This is my desired behaviour. It is exactly the same as the default zathura view method of VimTex.

What about users that want to --reuse instances?

Then can configure Sioyek to always reuse instances in their $XDG_CONFIG_HOME/sioyek/prefs_user.config.

If VimTeX introduces a g:vimtex_view_sioyek_options option, then these users can always add --reuse-instance to that.

Why can't users that don't want to --reuse instances do that?

Sioyek apparently takes priority for options stated on the command line. That is, if my $XDG_CONFIG_HOME/sioyek/prefs_user.config contains should_launch_new_instance 1, Sioyek will still --reuse the instance because that option was passed on the command line. This is also true for Sioyek's command line option --new-instance which is superseded by --reuse-instance. This means I can't create a wrapper

#/bin/bash
sioyek --new-instance "$@"

and pass this to VimTeX as g:vimtex_view_sioyek_exe.

lervag added a commit that referenced this issue Aug 24, 2022
@lervag
Copy link
Owner

lervag commented Aug 24, 2022

First: Thanks for the very good issue description. It's clear to me that the --reuse-instance should not be passed by default. I've removed it asap. Now, it may be useful/of interest to allow custom options, but I'm not sure if it is really necessary. So I'm considering to just leave it at that. I mean, Sioyek already has good support for more general user configuration, as you explain nicely.

@lervag
Copy link
Owner

lervag commented Aug 24, 2022

Opinions?

@rrueger
Copy link
Author

rrueger commented Aug 24, 2022

Fantastic!

I only mentioned adding g:vimtex_view_sioyek_options so that VimTeX would support exactly the same behaviour as before removing --reuse-instance. Of course, functionally virtually the same behaviour can be emulated using the Sioyek configuration.

Once again, thank you for responding and fixing this issue so quickly!

@lervag
Copy link
Owner

lervag commented Aug 24, 2022

My pleasure; thanks for the useful and good issue description.

I may add g:vimtex_view_sioyek_option later if anyone needs it. In the meantime, I'll take the liberty of closing this issue.

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

No branches or pull requests

2 participants