lervag / vimtex

VimTeX: A modern Vim and neovim filetype plugin for LaTeX files.
MIT License
5.5k stars 389 forks source link

Sioyek: synctex inverse search does not put focus on terminal with vim #2579

Closed 3ddiddE closed 1 year ago

3ddiddE commented 1 year ago

Like the title already says, the inverse search of sioyek at least seems to be broken for me. While the cursor is put to the correct row and col in the terminal window that runs vim, the focus stays in the sioyek window.

I do not have these problems with zathura, so at least I can eliminate a problem with my overall system setup I guess.

Do you have any ideas, why the focus is not transferred over to the vim-terminal?

System: Arch Sioyek Versions Tested: sioyek-appimage, sioyek-git from the AUR

lervag commented 1 year ago

If you have xdotool installed, then you can use a slightly "hacky" solution: Add this to your .vimrc file (or similar; whereever you configure your global autocommands and/or your VimTeX settings):

augroup init_vimtex
  autocmd!
  autocmd User VimtexEventViewReverse call b:vimtex.viewer.xdo_focus_vim()
augroup END
3ddiddE commented 1 year ago

Thank you for your solution!

I'd like to understand what the cause for this behavior is. Is there any particular reason that reverse search stopped working as expected? Unfortunately, I did not notice which commit has introduced this behavior

lervag commented 1 year ago

Yes. There was a change recently due to #2569.

lervag commented 1 year ago

Closing due to inactivity.

pyfb78 commented 8 months ago

Is there a way to do this without xdotool?

lervag commented 8 months ago

Is there a way to do this without xdotool?

Do what exactly? Please, feel free to open a new issue and fully describe your question.

pyfb78 commented 8 months ago

I'm sorry, I meant for the focus to be transferred back on over to the neovim-terminal after doing an inverse search in sioyek.

pyfb78 commented 8 months ago

Also, I'm super sorry but I just figured it out and all I had to do was switch vim to neovim.

lervag commented 8 months ago

Ah, I'm glad to hear that you got it working.

DaitiDay commented 4 months ago

I'm sorry I'm commenting under a closed issue, but is this "workaround" still working? I've tried implementing it in neovim with no success ,-, Looking at the help pages I can't find any reference to the xdo_focus_vim function.

lervag commented 4 months ago

I'm sorry I'm commenting under a closed issue, but is this "workaround" still working? I've tried implementing it in neovim with no success ,-, Looking at the help pages I can't find any reference to the xdo_focus_vim function.

Yes, it should still work. It is not really documented, though - sorry.

Feel free to open a new issue with a reference here and a description of what you're trying. I guess as a minimum it could lead to improved docs.