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
Synctex doesn't work properly on Mac (Zathura or Skim) #2889
Comments
To be honest, my current thought is that you are still lazy loading VimTeX. So let's start by looking at that.
Which
This sure sounds like a lazy loading issue...
Please change And, important: Do you perhaps have a global lazy load option for lazy.nvim enabled? In other words, what is your configuration of lazy.nvim itself? What happens if you run this from a terminal?
|
"I tried not to use lazy features" actually means I removed my personal key map which had been set using I don't think my current situation is about lazy load, because I also tried to switch
No. Just default settings.
The one suggested in the Issue template. set nocompatible
let &runtimepath = '~/.vim/bundle/vimtex,' . &runtimepath
let &runtimepath .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable
" Add relevant options and VimTeX configuration below.
let g:vimtex_view_method = 'zathura_simple' The problems can still reproduce when I run
If open the tex file at first
then run the above command in another terminal, the command returns 0, and the cursor jumps to L25 in the Vim buffer in the first terminal. With minimal.vim, it behaves the same way. P.S., there is a LaTeX Font Warning during compilation (
|
Ok, good!
Ok; but notice that you should still keep this change. VimTeX assumes that the options are defined before you load it, and I've found that
Ok; can we continue the thread using this
Ok, so the problem persists regardless of whether you are using Vim or neovim? Notice, though, you should use
Good, that asserts that you are not lazy loading.
You are right, this is not relevant. Now, I believe the next step for going in depth here is to have a proper LaTeX \documentclass{minimal}
\begin{document}
Hello World!
\newpage
Hello Moon!
\end{document} Given
|
Also, just to be fully sure, could you comment out the config in your |
After remove ~/.latexmkrc, and run
|
Ok, so things work except inverse sync. Can you post the output of zathura -x "nvim --headless -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 57:8:'mwe.tex' 'mwe.pdf'& Now, if you run that command (modified to match what you find in |
System info:
OS: macOS 12.7.2 (21G1974)
Vim version: NVIM v0.9.5
Has clientserver: true
Servername: /var/folders/2k/r2yhqxdj0d54j8k7_wp94xj80000gn/T/nvim.rabbit/ehpwhg/nvim.26189.0
VimTeX project: mwe
base: mwe.tex
root: /Users/rabbit/tmp/test
tex: /Users/rabbit/tmp/test/mwe.tex
main parser: current file verified
document class: minimal
compiler: latexmk
engine: -pdf
options:
-verbose
-file-line-error
-synctex=1
-interaction=nonstopmode
callback: 1
continuous: 1
executable: latexmk
job:
jobid: 5
output: /var/folders/2k/r2yhqxdj0d54j8k7_wp94xj80000gn/T/nvim.rabbit/ehpwhg/0
cmd: max_print_line=2000 latexmk -verbose -file-line-error -synctex=1 -interaction=nonstopmode -pdf -pvc -pvctimeout- -view=none -e '$compiling_cmd = ($compiling_cmd ? $compiling_cmd . " ; " : "") . "echo vimtex_compiler_callback_compiling"' -e '$success_cmd = ($success_cmd ? $success_cmd . " ; " : "") . "echo vimtex_compiler_callback_success"' -e '$failure_cmd = ($failure_cmd ? $failure_cmd . " ; " : "") . "echo vimtex_compiler_callback_failure"' 'mwe.tex'
pid: 26190
viewer: Zathura
cmd_start: zathura -x "/Users/rabbit/rmac.local/neovim/bin/nvim --headless -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 7:1:'/Users/rabbit/tmp/test/mwe.tex' 'mwe.pdf'&
qf method: LaTeX logfile
I'm not sure what do you mean by "the initial window", you mean the initial viewer window? I closed the viewer zathura window. and run $ zathura -x "/Users/rabbit/rmac.local/neovim/bin/nvim --headless -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 7:1:'/Users/rabbit/tmp/test/mwe.tex' 'mwe.pdf'&
[1] 26555
~/tmp/test
$ warning: Unknown option: best-fit It opens Zathura and do the forward sync to the 2nd page "Hello Moon!" which is as expected. Then when I click "Hello World!" on the 1st page in Zathura, nothing happened. No error output in the terminal. |
Ok, that's strange. And if you; while having the mwe open after step 2 above; run |
Btw., do you have the same issue with Skim? |
Also, notice (just so it's clear) that |
zathura -x "/Users/rabbit/rmac.local/neovim/bin/nvim --clean -u minimal.vim --headless -c \"VimtexInverseSearch %{line} '%{input}'\"" --synctex-forward 7:1:'/Users/rabbit/tmp/test/mwe.tex' 'mwe.pdf'& I ran with
Yes. Inverse sync doesn't work either if I switch the method to Skim let g:vimtex_view_method = 'skim' |
Btw, this has nothing to do with plugin manager right(I don't config Vundle.vim right now). Since we already use minimal.vim. |
I'm not sure if that will work; but I think it should work if you use the absolute path to the However, if you don't use |
No, it may be related to your plugin manager. VimTeX asks Zathura to use the PS! Notice that you should have a space before the start paranthesis ;) (mentioning it because I've noticed you did the same thing a couple of times). |
So, one way to test things more directly: mv ~/.config/nvim ~/.config/nvim_old
mkdir ~/.config/nvim
mv minimal.vim ~/.config/nvim/init.vim Now, ensure |
I did as you said. mv ~/.config/nvim ~/.config/nvim_old
mkdir ~/.config/nvim
mv minimal.vim ~/.config/nvim/init.vim Now it's clean for sure > ls ~/.config/nvim
init.vim
> ls ~/.vim/bundle
vimtex
> ls
mwe.tex
~/tmp/test
> vim mwe.tex And there is no ~/.latexmkrc Still the same:
mwe.log
My bad, thanks for the reminder. :) |
I also tested on a remote Linux node (through SSH + X forward) with the same clean minimal environment and same 0.9.5 nvim build from source. Same results. |
Is there any possibility that there is problem in inverse direction dbus communication (viewer to editor)? Since it fails on both Zathura and Skim. |
To be honest, I'm starting to be all out of ideas here. I didn't think there was any dbus communication when you used Skim. And I have no idea why this does not work in the minimal case. Did you try with Vim as well as neovim? |
I finally got MacVim + Skim case work. Install MacVim(which is based on Vim), since Skim Sync settings can select MacVim as one of sync support editor, with preset
Run,
I will try more cases. |
Will revisit this issue tomorrow. Just found this article by @ejmastnak , will read and have a try. |
Does this work if you use the recommended setting from
Yes, the writings of @ejmastnak are very good and should be up to date (as far as I know). Thus they are a great resource for these things. |
Returning focus to Neovim after inverse search on macOS I really think the above writings of @ejmastnak could fix my problems:
Unfortunately, the If no further progress in the next few days, I'll close this thread. |
Just verified inverse search with Zathura successfully. The key point is to mentioned in Forward search and inverse search Sorry for taking up so much of your time and thanks a lot for your kindly help. @lervag Let me summarize what I learned:
About dbus service, however, sometimes it may fail to start like this > brew services
Name Status User File
dbus stopped rabbit ~/Library/LaunchAgents/org.freedesktop.dbus-session.plist
> launchctl list | grep dbus
- 0 org.freedesktop.dbus-session
If you cannot fix this, like my case, don't worry, just launch the daemon manually, dbus-daemon --fork --session --address=$DBUS_SESSION_BUS_ADDRESS
The directives set in the custom conf. overrides the counterparts in the default conf. This means
can be set in > cat /usr/local/etc/dbus-1/session-local.conf
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<auth>DBUS_COOKIE_SHA1</auth>
</busconfig> without touching the original default one. |
It never crossed my mind that you didn't know this already... sorry for not mentioning that earlier! But I'm glad to hear it works!
Glad to help!
Thanks for the info. Feel free to suggest updates to the docs if you think something should be added. |
Glad to hear this is resolved :) @rltyty, thank you for the notes on manually starting the D-Bus daemon! I've just added a short note about manually starting D-Bus to the tutorial and mentioned your contribution (I hope you don't mind). I hope this will help others, since a lot of people trying the macOS-Zathura setup seem to get stuck at the launching D-Bus step. (I don't have access to a Mac these days (much less an Apple Silicon Mac) on which I could test the Zathura-macOS setup myself, so it is valuable and appreciated to get info from readers! |
@ejmastnak No, thank you for your comprehensive and clear tutorials and keep them up to date. It's my pleasure to provide any useful information to others who might encounter the same issue. |
@lervag , I notice that you have mentioned @ejmastnak 's series in section Or if you feel it's necessary to point out the work-around, maybe you could add something like "Any users encounter after "try the recipe in [3]." in step 4 of and "[4]: #2889 (comment)" |
Description
Nvim + vimtex + Zathura once worked fine in my mac. However recently, after I upgraded system and switch to Nvim + lazy.nvim, they don't work properly now. I tried not to use lazy features for Vimtex after I read the help doc. I also tried to use minimal.vim, the problem still exists.
The current status is after I type
<leader>ll
or<leader>lv
, it can open Zathura/Skim to display the PDF. But the sync doesn't work as expected.For Zathura (which I mainly use), it reports "VimTex: Viewer cannot find Zathura window ID!" I already read related issues in history. Basically, the issue still exists, which is xdotool can find no id of zathura. So I switch the method to "zathura_simple", then the error disappears as expected. Now here are the sync problems:
Forward search is not automatic/continuous. I remember the viewer (Zathura) was able to focus on the point where the cursor was at in the tex file being edited. However, now, I have to manually trigger the forward search by type
<leader>lv
every time. I mean it can sync, but not continuously/automatically.Inverse search doesn't work at all. the cursor is not able to relocate in the editor after I select/click the text here and there in the pdf viewer Zathura.
If you could shed some light on this, I would really appreciate. Thanks in advance.
Steps to reproduce
:checkhealth vimtex
nvim Lua configuration
Expected behavior
No response
Actual behavior
No response
Do you use a latexmkrc file?
~/.latexmkrc
VimtexInfo
The text was updated successfully, but these errors were encountered: