Closed 594212 closed 5 months ago
I already tried that you describe in others issues:
- Open ~/textest/main.tex with neovim.
- Open a terminal and go to the project root directory with cd.
- In neovim: Compile the project \ll . Sioyek opens, I can close it.
- In the terminal, run nvim --headless -c "VimtexInverseSearch 10 '~/textest/main.tex'", This should open the specified file at the specified line in neovim
It didn't work, cursor not moving.
return { "lervag/vimtex", lazy = false, init = function() -- Use init for configuration, don't use the more common "config". vim.g.vimtex_view_general_viewer = 'sioyek' vim.g.vimtex_callback_progpath = "C:\\Windows\\system32\\wsl.exe nvim" end }
You did not really read the docs well enough. Sioyek has its own configuration, so you should use this:
return {
"lervag/vimtex",
lazy = false,
init = function()
vim.g.vimtex_view_method = 'sioyek'
-- vim.g.vimtex_callback_progpath = "C:\\Windows\\system32\\wsl.exe nvim"
-- I believe you can simplify this to:
vim.g.vimtex_callback_progpath = "wsl nvim"
end
}
Please read :help vimtex-view-sioyek
, as well as :help vimtex-faq-wsl
for more info.
I'm sorry, I already tried that, while was trying figured out what's going I lost vim.g.vimtex_view_method = 'sioyek'
, first time I'm tried with this. sioyek opens on the correct line, but inverse search not working.
Just so you know, since you mentioned it, I tried again. However, it didn't work.
You did not really read the docs well enough
this line is hurt
also, If it is important, instead of adding sioyek.exe to %PATH
I created symbol link to execution
/usr/bin/sioyek -> /mnt/c/Users/sul/AppData/Local/Microsoft/WinGet/Packages/ahrm.sioyek_Microsoft.Winget.Source_8wekyb3d8bbwe/sioyek-release-windows/sioyek.exe
so it is why I don't use vim.g.vimtex_view_sioyek_exe = 'sioyek.exe'
You did not really read the docs well enough
this line is hurt
Sorry, that was not my intent. Using the general viewer (vimtex_view_method = "general"
) instead of the specific (vimtex_view_method = "sioyek"
) indicated that you did not know that there is a specific one.
I'm sorry, I already tried that, while was trying figured out what's going I lost
vim.g.vimtex_view_method = 'sioyek'
, first time I'm tried with this. sioyek opens on the correct line, but inverse search not working.
Ok, do I understand correctly that with this, forward search works as expected? Forward search will not work with vimtex_view_general_viewer = "sioyek"
, so this is an improvement.
Can you do :VimtexInfo
again and report the viewer:
part after you have opened a tex file and after the viewer has started? I want to see the viewer.job.cmd
.
also, If it is important, instead of adding sioyek.exe to %PATH I created symbol link to execution
/usr/bin/sioyek -> /mnt/c/Users/sul/AppData/Local/Microsoft/WinGet/Packages/ahrm.sioyek_Microsoft.Winget.Source_8wekyb3d8bbwe/sioyek-release-windows/sioyek.exe
so it is why I don't use
vim.g.vimtex_view_sioyek_exe = 'sioyek.exe'
Ok. So, first, I don't use Windows and I may not be able to help you here. But I'll try.
Now, it seems you are using neovim inside Ubuntu in WSL. And that Sioyek is installed on the Windows side of things. It also seems that this works well, except for the inverse search.
Now, I think the first step here is to check that the inverse search method works at all. Can you do this?
cd textest
, then nvim main.tex
.\ll
), then close the viewer if it opens and restart neovim (:q
then nvim main.tex
).cd textest
, then:nvim --headless -c "VimtexInverseSearch 10 '/home/sul/textest/main.tex'"
The third action should move your cursor in neovim in the first terminal to the specified file at the specified line. Can you test and let me know what happens?
Ok, do I understand correctly that with this, forward search works as expected? Forward search will not work with vimtex_view_general_viewer = "sioyek", so this is an improvement.
Year, when I used vimtex_view_general_viewer = "sioyek"
is only opens sioyek but not in correct line, now with
vimtex_view_method = "sioyek"
it opens correctly on correct line
Can you do :VimtexInfo again and report the viewer: part after you have opened a tex file and after the viewer has started? I want to see the viewer.job.cmd.
viewer: sioyek job: pid: 37876 cmd: sioyek.exe --inverse-search "wsl nvim --headless -c \"VimtexInverseSearch %2 '%1'\"" --forward-search-file '/home/sul/textest/main.tex' --forward-search-line 15 '/home/sul/textest/main.pdf' cmd_start: sioyek.exe --inverse-search "wsl nvim --headless -c \"VimtexInverseSearch %2 '%1'\"" --forward-search-file '/home/sul/textest/main.tex' --forward-search-line 15 '/home/sul/textest/main.pdf' qf method: LaTeX logfile
Now, I think the first step here is to check that the inverse search method works at all. Can you do this?
- Open a terminal and cd textest, then nvim main.tex.
- Start compilation (\ll), then close the viewer if it opens and restart neovim (:q then nvim main.tex).
- Open a new terminal and cd textest, then:
- nvim --headless -c "VimtexInverseSearch 10 '/home/sul/textest/main.tex'"
The third action should move your cursor in neovim in the first terminal to the specified file at the specified line. Can you test and let me know what happens?
it is a magic it jumped on correct line!!!
also I tried wsl nvim --headless -c "VimtexInverseSearch 10 '/home/sul/textest/main.tex'"
and it work.
Maybe I don't use keystroke correctly?
Press f4 to toggle synctex mode (toggle_synctex command). While in this mode, right clicking on any text opens the corresponding tex file in the appropriate location.
but is still not working
The third action should move your cursor in neovim in the first terminal to the specified file at the specified line. Can you test and let me know what happens?
it is a magic it jumped on correct line!!! also I tried
wsl nvim --headless -c "VimtexInverseSearch 10 '/home/sul/textest/main.tex'"
and it work.
Great, I'm glad to hear it.
Maybe I don't use keystroke correctly?
Press f4 to toggle synctex mode (toggle_synctex command). While in this mode, right clicking on any text opens the corresponding tex file in the appropriate location.
but is still not working
It seems you are doing things correctly. It's hard to say what is wrong here, to be honest. I don't use this system combination and I don't really know how to figure things out if I can't test it myself.
One thing you could try: There's an :execute
command in Sioyek that you can use to execute shell commands. Can you perhaps test what happens if you do something like this:
:execute wsl echo "hello world"
(does it print anything?):execute wsl nvim --headless -c "VimtexInverseSearch 10 '/home/sul/textest/main.tex'"
One thing you could try: There's an :execute command in Sioyek that you can use to execute shell commands. >Can you perhaps test what happens if you do something like this:
- :execute wsl echo "hello world" (does it print anything?)
- :execute wsl nvim --headless -c "VimtexInverseSearch 10 '/home/sul/textest/main.tex'"
it worked, its jumped on correct line, what can be a problem
That's interesting. Another thing you can try is to start Sioyek yourself to specify the inverse search command. This way, we can check that it actually does something. Do this:
cd textest
sioyek.exe --inverse-search "wsl echo %2 %1 >> /home/sul/textest/test-sync.log" '/home/sul/textest/main.pdf'
<f4>
, right click in the document, and check if the test-sync.log
file is created and received content.So, here we simply change the inverse search command to output the line number and filename to a file test-sync.log
. This is more or less as "basic" as we can go. If this doesn't work, then I really have no idea what's wrong.
Note, if this does not work, then you might have noticed that we really didn't use VimTeX this time - as such, it may be relevant to ask at the Sioyek repo (https://github.com/ahrm/sioyek).
file is created, but /home/sul/textest/test-sync.log
15 homesul extestmain.tex
7 homesul extestmain.tex
7 homesul extestmain.tex
3 homesul extestmain.tex
it writes wrong path, so apparently it related to sioyek not vimtex. Anyway, thank you, I really appreciate your help!
Huh; actually, it seems that it does output the correct path, except the string interprets the path seperators as escapes such that \t
becomes a tab character. You could try to use ... "wsl echo %2 '%1' ...
.
Description
I'm using nvim with wsl Ubuntu and inverse search not working. I already tried that you describe in others issues:
It didn't work, cursor not moving.
plugins/vimtex.lua
instruction above, was executed in wsl, so I think, vim.g.vimtex_callback_progpath dosn't matter, if is not working within wsl
Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Do you use a latexmkrc file?
No
VimtexInfo