Closed avonmoll closed 2 years ago
Previously, if I had Skim already running (on another desktop with some other pdfs already opened in tabs), the output pdf would be opened as a tab in the existing Skim window.
Do you know when the change in behavior began to better diagnose the problem? Perhaps it has something to do with the refactor in #2289, although that was a little while ago.
Here's my two cents:
The code to open Skim is, I believe, in line 57 of autoload/vimtex/view/skim.vim
and its surrounding context.
The code appears to use the Application.open
method from macOS's JavaScript for Automation (JXA) scripting architecture. Out of curiosity I took a look at the relevant documentation (you can take a look yourself on macOS: open Script Editor.app
> File
> Open Dictionary
> Skim.app
), and it doesn't seem like Apple exposes much functionality for opening in tabs vs. windows; I found a basic open
method and that was that. In other words, the fault here may be with the limitations of Apple's JXA rather than with VimTeX.
But I use Apple only occasionally so I'm no expert here and may be missing something obvious; perhaps @clason, who contributed #2289, will know if Apple makes it easy/feasible to implement the open-a-tab-in-an-existing-window-in-a-different-desktop behavior you're interested in.
Using the
vimtex_view_method = 'skim'
, a new Skim window opens, unless the associated output pdf is already open in a Skim instance or the Skim window is on the current desktop. Previously, if I had Skim already running (on another desktop with some other pdfs already opened in tabs), the output pdf would be opened as a tab in the existing Skim window.
I'm sorry to say I can't help directly with this issue as I don't use MacOS. Luckily, our community has other knowleadgable users! Thanks to @ejmastnak for pitching in.
In other words, the fault here may be with the limitations of Apple's JXA rather than with VimTeX.
I believe this may be true, but I'm not sure. One question for @ejmastnak (and possibly @clason): Is this issue reproducible on your end?
By the way, you can simplify your VimTeX config. Specifically, these two options are not needed (the first is not a VimTeX option, and the second is unnecessary since you are not changing from the default value):
let g:tex_flavor = 'latex'
let g:vimtex_compiler_method = 'latexmk'
As @ejmastnak points out, the scripting support is limited, underdocumented, and poorly maintained (by Apple -- things can randomly break in any macOS update without warning or acknowledgment); it was already non-trivial to get the current, deliberately limited, support working. The refactor in #2289 was necessary because one of those silent changes in a macOS update completely broke the previous approach.
In any case, the previous behavior around tabs was unintended and a (for you) "happy little accident". From my cursory search on the internet, there doesn't seem to be a straightforward way to do so; every workaround I've seen involves scripting user interaction (menu selection etc.), which I do not want to do as it makes these scripts even less robust and harder to maintain.
So I'm sorry to say that this is a "wontfix" on my end...
Thanks for pitching in, @clason. I'll close the issue with tag "won't fix". But of couse, I will be happy to continue the discussion and to consider possible PR's if anyone should feel so inclined.
I came across this which says to run
defaults write -app Skim AppleWindowTabbingMode -string always
to open pdfs as tabs instead of windows. Running that command and restarting Skim seems to do the trick. Just thought I'd drop that in here in case anyone comes across this in the future.
Description
Using the
vimtex_view_method = 'skim'
, a new Skim window opens, unless the associated output pdf is already open in a Skim instance or the Skim window is on the current desktop. Previously, if I had Skim already running (on another desktop with some other pdfs already opened in tabs), the output pdf would be opened as a tab in the existing Skim window.Vimtex options:
Steps to reproduce
nvim -u minimal.vim minimal.tex
:VimtexCompile
Expected behavior
minimal.pdf
is opened as a tab on the existing Skim window.Actual behavior
A new Skim window appears on the current desktop with a single tab containing
minimal.pdf
.Do you use a latexmkrc file?
Yes
VimtexInfo