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

VimTeX "integration" #8

Closed
lervag opened this issue Jul 24, 2021 · 14 comments
Closed

VimTeX "integration" #8

lervag opened this issue Jul 24, 2021 · 14 comments

Comments

@lervag
Copy link

lervag commented Jul 24, 2021

First, congratulations with developing something that immediately looks very promising as a PDF reader for scientists! It seems you have already implemented a lot of novel and very interesting features.

I'm the developer of a Vim plugin for writing LaTeX: VimTeX. If (and when) you think this viewer is suitable for working with PDFs generated from LaTeX e.g. with synctex support, I would be happy to add sections for how to properly configure Vim with VimTeX to use this viewer. Perhaps also add a full layer similar to what I've done with Skim, Zathura and MuPDF.

Let me know if you are interested in a collaboration for this type of direction; and of course, feel free to close the issue if you think this is better addressed by others/the community/at a later time/...

@ahrm
Copy link
Owner

ahrm commented Jul 24, 2021

I am very interested in adding support for synctex. Currently I am busy trying to get the Linux and MacOS builds running but once I am done with that, adding synctex support is pretty high on my priority list.

@lervag
Copy link
Author

lervag commented Jul 24, 2021

Great! When there's a working Linux version with synctex support, then I will be glad to test it. I can then add docs for VimTeX for how to configure things.

Note: For a good Vim/neovim integration, it is useful to allow to pass to the viewer the command needed for reverse synchronization. Zathura allows this with the --synctex-editor-command option (-x for short), and this makes it easy to properly integrate Zathura with Vim. I therefore suggest that you allow such a command-line option in addition to a more permanent configuration file.

@ahrm
Copy link
Owner

ahrm commented Aug 6, 2021

Great! When there's a working Linux version with synctex support, then I will be glad to test it. I can then add docs for VimTeX for how to configure things.

Note: For a good Vim/neovim integration, it is useful to allow to pass to the viewer the command needed for reverse synchronization. Zathura allows this with the --synctex-editor-command option (-x for short), and this makes it easy to properly integrate Zathura with Vim. I therefore suggest that you allow such a command-line option in addition to a more permanent configuration file.

I have added synctex support in c1e6158 . There are still no stable release with synctex support but here is an experimental build of the latest commit:

https://github.com/hexomancer/sioyek/releases/tag/v0.31.78

The way it works is that we use a hotkey (<F4> by default) to enable "synctex mode". And while we are in synctex mode, right clicking on a document performs an inverse search.

Here is what I added to vimrc to integrate it with Vimtex:

let g:vimtex_view_general_viewer = '/home/ahrm/Sioyek-x86_64.AppImage'
let g:vimtex_view_general_options = '--inverse-search "nvr --remote-expr \"vimtex#view#reverse_goto(%2, ''%1'')\"" --reuse-instance --forward-search-file @tex --forward-search-line @line @pdf'
let g:vimtex_view_general_options_latexmk = '--reuse-instance'

The interface is very similar to SumatraPDF, the differences are:

  • we use --option instead of -option
  • we use %1 for the name of the file and %2 for the line number (as opposed to %f and %l)
  • there are two separate options for specifying the line and file name for forward search: --forward-search-file and forward-search-line

Please notify me if there are any issues or there are improvements I can make.

@ahrm
Copy link
Owner

ahrm commented Aug 26, 2021

I have added a release with Synctex here:

https://github.com/ahrm/sioyek/releases/tag/v0.31.6

@ahrm ahrm closed this as completed Aug 26, 2021
@lervag
Copy link
Author

lervag commented Aug 28, 2021

Great! I'm happy to see this. I'll write up corresponding docs immediately.

In the future, it could be nice to make a dedicated viewer interface/method to simplify configuration. I'll wait with that until Sioyek matures. My first impression is that you are really on to something very useful with this PDF viewer. If you keep up the good work, I may switch to it myself!

(One minor thing I'm missing, just FYI: I'd like to press q to quit the viewer. I did not immediately see how to configure that.)

lervag added a commit to lervag/vimtex that referenced this issue Aug 28, 2021
@lervag
Copy link
Author

lervag commented Aug 28, 2021

Feel free to comment on the text I've added to the VimTeX doc. Let me know if you think it should be changed/improved!

@ahrm
Copy link
Owner

ahrm commented Aug 29, 2021

(One minor thing I'm missing, just FYI: I'd like to press q to quit the viewer. I did not immediately see how to configure that.)

I have added to ability to configure quit command in 98a5438. You can currently also use :q to quit just like vim.

Feel free to comment on the text I've added to the VimTeX doc. Let me know if you think it should be changed/improved!
The documentation looks very good. Thank you.

@lervag
Copy link
Author

lervag commented Aug 29, 2021

I have added to ability to configure quit command in 98a5438. You can currently also use :q to quit just like vim.

Ah, great!

The documentation looks very good. Thank you.

Great, happy to hear it.

@lervag
Copy link
Author

lervag commented Nov 13, 2021

I've updated the inverse search mechanisms in VimTeX and updated the Sioyek docs. Perhaps you could update the corresponding docs for VimTeX integration from Sioyek as well?

https://github.com/lervag/vimtex/blob/8dad88059f7d712c1f6ff83c6aaa2ef9645a3787/doc/vimtex.txt#L5080-L5092

@ahrm
Copy link
Owner

ahrm commented Nov 13, 2021

Updated in 8d221404883dc3c2c20bd0ff62a168b5331ee20f and 1a50331.

@lervag
Copy link
Author

lervag commented Dec 9, 2021

New update: I've pushed a native VimTeX backend for Sioyek. It should now work with simply

let g:vimtex_view_method = 'sioyek'

@euglevi
Copy link

euglevi commented Jun 15, 2022

I am not sure why, but inverse search does not seem to work for me. I have the new version of vimtex, nvim 0.7, and the last stable release of Sioyek. After compiling the pdf with vimtex on nvim, I activate synctex with F4 but when I right-click with the mouse nothing happens. The only lines of codes in my nvim config are:

g.vimtex_view_method='sioyek'
g.vimtex_view_sioyek_exe='Sioyek-x86_64.AppImage'

Am I doing something wrong? Thank you.

@euglevi
Copy link

euglevi commented Jun 15, 2022

Sorry stupid mistake on my side. I was lazy loading vimtex.

@lervag
Copy link
Author

lervag commented Jun 15, 2022

Glad to hear you figured it out yourself. Be careful with lazy loading. Most plugins, like VimTeX, are already lazily loaded, and doing custom lazy loading on top of that can break things.

viccie30 pushed a commit to viccie30/sioyek that referenced this issue Dec 22, 2022
document selection region for scripts
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

3 participants