Inverse search does not work with sioyek
Description
Hi!
With the default config, inverse search should just work, but it doesn't. Not sure where to start.
Sioyek ~
https://sioyek.info/
Sioyek is a PDF viewer designed for reading research papers and technical
books.
Configuration: >vim
let g:vimtex_view_method = 'sioyek'
Inverse search should be automatically configured and work out of the box.
VimTeX will try to pass options to Sioyek to automatically configure inverse
search. This means that, in most cases, inverse search should work as expected
without any further configuration. One may still be interested in learning how
inverse-search configuration works, in which case one should read
|vimtex-synctex-inverse-search|. The interpolation variables for Sioyek
configuration are `%2` and `%1`, not `%l` and `%f`.
Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Do you use a latexmkrc file?
No
VimtexInfo
System info:
OS: Gentoo Linux
Vim version: VIM 9.0 (1-2167)
Has clientserver: true
Servername: GVIM
VimTeX project: hyp.29
base: hyp.29.tex
root: /home/khu/cloud/2017_02_22-Markov-YT/hyp
tex: /home/khu/cloud/2017_02_22-Markov-YT/hyp/hyp.29.tex
main parser: current file verified
document class: article
packages: amsbsy amsfonts amsgen amsmath amsopn amssymb amstext amsthm array atbegshi atbegshi-ltx atveryend atveryend-ltx auxhook bigintcalc bitset calc defpattern enumitem epstopdf-base etexcmds expl3 fp fp-addons fp-basic fp-eqn fp-eval fp-exp fp-pas fp-random fp-snap fp-trigo fp-upn fullpage gettitlestring graphics graphicx hycolor hyperref iftex infwarerr intcalc keyval kvdefinekeys kvoptions kvsetkeys letltxmacro ltxcmds mathtools mhsetup nameref numprint pdfescape pdftexcmds pgf pgfcomp-version-0-65 pgfcomp-version-1-18 pgfcore pgffor pgfkeys pgfmath pgfplots pgfrcs pgfsys refcount rerunfilecheck tikz tikz-cd tkz-base tkz-euclide trig uniquecounter url xcolor xfp
compiler: latexmk
engine: -pdf
options:
-verbose
-file-line-error
-synctex=1
-interaction=nonstopmode
callback: 1
continuous: 1
executable: latexmk
job:
jobid: process 1045782 run
output: /tmp/vsUHX6k/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"' 'hyp.29.tex'
pid: 1045782
viewer: sioyek
job:
pid: 1045786
cmd: /opt/sioyek/sioyek --inverse-search "/usr/bin/gvim -T dumb --not-a-term -n -c \"VimtexInverseSearch %2 '%1'\"" --forward-search-file '/home/khu/cloud/2017_02_22-Markov-YT/hyp/hyp.29.tex' --forward-search-line 173 '/home/khu/cloud/2017_02_22-Markov-YT/hyp/hyp.29.pdf'
cmd_start: /opt/sioyek/sioyek --inverse-search "/usr/bin/gvim -T dumb --not-a-term -n -c \"VimtexInverseSearch %2 '%1'\"" --forward-search-file '/home/khu/cloud/2017_02_22-Markov-YT/hyp/hyp.29.tex' --forward-search-line 173 '/home/khu/cloud/2017_02_22-Markov-YT/hyp/hyp.29.pdf'
qf method: LaTeX logfile
My config:
call plug#begin()
Plug 'lervag/vimtex'
call plug#end()
let g:vimtex_view_method = 'sioyek'
let g:vimtex_view_sioyek_exe = '/opt/sioyek/sioyek'
filetype plugin on
filetype indent on
syntax on
Actually, any suggestions for a pdf viewer where synctex would work in wayland? Zathura is great but it frequently crashes, possibly because of this https://git.pwmt.org/pwmt/zathura/-/issues/261 Sioyek does not work with default suggested settings, but maybe this will get better. There's okular, but I don't use KDE and it is very heavy on dependencies Anything else?
I notice you are running gvim; could you try to specify vim as the callback program, like this:
let g:vimtex_callback_progpath = '/usr/bin/vim'
I'm not sure, but I think this might help.
Regarding your config: Notice that call plug#end() will do the filetype plugin indent on and syntax on, so you don't need those lines.
Actually, any suggestions for a pdf viewer where synctex would work in wayland? Zathura is great but it frequently crashes, possibly because of this https://git.pwmt.org/pwmt/zathura/-/issues/261
To be honest, I've not used VimTeX on Wayland myself, and I don't know which viewers work well with inverse search. I expect sioyek might work, but I'm not sure. I also believed that Zathura worked, but again, not tested.
Thanks!
I already tried with
let g:vimtex_callback_progpath = '/usr/bin/vim'
but nothing changed. (I had to do this to get zathura to work, so I knew to try this.)
Zathura works great, but it crashes after a few recompilations, it is very distracting. I tried live (git) version of zathura, it crashes differently but still crashes. In qpdfview inverse search works every fourth time and is not really usable. In sioyek inverse search currently does not work.
The situation with zathura is quite remarkable. I created an issue: https://github.com/pwmt/zathura/issues/591 and:
- there's a workaround for me: using popper as a backend instead of mupdf, which seems to fix the crashes (great!!!)
- there are other people with similar problems, and A LOT of reports of various segfaults in zathura, really impressive
So now zathura works for me, but it looks so delicate and unstable...
I'm still on a lookout for a pdf viewer with inverse search what just works on wayland, and in particular if I can get sioyek to work
Sorry for the late reply!
I already tried with …
Ah, bummer. I hope this would be a solution here.
Zathura works great, but it crashes after a few recompilations, it is very distracting.
Also bummer; I personally like the simplicify of Zathura very much and still use it as my go to viewer.
In sioyek inverse search currently does not work.
Just a stupid question: Could you explain how you invoke inverse search in Sioyek?
The situation with zathura is quite remarkable. …
So now zathura works for me, but it looks so delicate and unstable...
Oh, nice. Glad to hear that! Still, it's strange that these things don't work as expected on Wayland.
I'm still on a lookout for a pdf viewer with inverse search what just works on wayland, and in particular if I can get sioyek to work
I've still ignored Wayland, personally - Xorg just works for me, and I've not really understood why I should consider to change to Wayland yet. I do see that it is gaining traction, and it will probably catch up at some time - when it does, I'll switch.
In any case, I believe your issue here is really with Sioyek, not with VimTeX. Still, I can help you to debug this, if you want.
Thanks! I have very little time these days, and once I figured out how to workaround zathura's crashes, I just switched to it and was happy. But in the long run it would be nice to make sioyek work too.
I tried it like this: I changed my .vimrc as above, and that's all. In sioyek I press f4, and then either right click or control-click, I don't remember. If I open a pdf independently from vimtex, then such actions make sioyek complain that synctex is not setup. If a pdf is open via vimtex, then sioyek does not complain, but the inverse search does not work.
If you have any pointers to how to debug the interaction between sioyek and vimtex, I'd try to solve this. Although I will be slow.
I don't remember why I use wayland. Curiosity maybe...
Thanks! I have very little time these days, and once I figured out how to workaround zathura's crashes, I just switched to it and was happy.
Well, there's really nothing wrong with that!
But in the long run it would be nice to make sioyek work too.
I tried it like this: I changed my .vimrc as above, and that's all. In sioyek I press f4, and then either right click or control-click, I don't remember. If I open a pdf independently from vimtex, then such actions make sioyek complain that synctex is not setup. If a pdf is open via vimtex, then sioyek does not complain, but the inverse search does not work.
Great; this verifies that you are "doing it correctly".
If you have any pointers to how to debug the interaction between sioyek and vimtex, I'd try to solve this.
To debug this further, we want to adjust the sioyek inverse search command. You can specify it in the sioyek config directly, so let's start there. As you can see from :VimtexInfo, the inverse search command that VimTeX specifies is this:
/usr/bin/vim -T dumb --not-a-term -n -c "VimtexInverseSearch %2 '%1'"
You can add the following config to your ~/.config/sioyek/prefs_user.config file. Let's start simple.
inverse_search_command echo "%2 '%1'" >> ~/sioyek-test.log
Now, if you open a pdf independently from VimTeX and issue inverse search, you should see the file sioyek-test.log being created and filled with some content. It should be a number and then a file name, for each line. When you have the time, please confirm it.
Although I will be slow.
Slow is smooth, smooth is fast. I've heard.
Thanks! I have very little time these days, and once I figured out how to workaround zathura's crashes, I just switched to it and was happy. But in the long run it would be nice to make sioyek work too.
I tried it like this: I changed my .vimrc as above, and that's all. In sioyek I press f4, and then either right click or control-click, I don't remember. If I open a pdf independently from vimtex, then such actions make sioyek complain that synctex is not setup. If a pdf is open via vimtex, then sioyek does not complain, but the inverse search does not work.
If you have any pointers to how to debug the interaction between sioyek and vimtex, I'd try to solve this. Although I will be slow.
I don't remember why I use wayland. Curiosity maybe...
I recently migrate to macOS and encountered this issue, and I resolve this by cleaning then recompiling latex files. I suspects that there are some inconsistency in the synctex file resulting in inverse search failed.
I'll close this for now; feel free to reopen or just continue the discussion - I'll respond to followup-comments!
In case someone else comes here searching for answers.
Go to ~/.config/sioyek/prefs_user.config
Add the following
# The command to use when trying to do inverse search into a LaTeX document.
# %1 expands to the name of the file and %2 expans to the line number.
inverse_search_command nvim --headless -c "VimtexInverseSearch %2 '%1'"