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
xwin id for files of the same name in different paths not correctly identified #947
Comments
I looked a bit through the source code and I found that lines 99-106 in After digging some further I found, that the So, I think there is some problem with the EDIT: I just tried to reproduce this with a simple example: /tmp/a/file.tex
I then copied this file to After compiling the files, I open them in neovim in two different terminal windows. If I call |
Yes, this is actually a problem I am aware of. I tried once to find a good solution, but unfortunately I was not able to. I don't quite see how to solve this, because the full paths of the files are not available when searching for the window ids. Thus, when we have two files with the same name, I have not found a reliable method of getting the correct window id. Since the last time I worked on this, I have become better at creating good tests, and so I will make test files for this issue to replicate the problem again. I will also see if I can find a better way to handle it. Perhaps I can find useful information that can be parsed from Just to be sure, your final edit indicates that your entire problem has to do with finding the correct window ID when the pdf files have the same basename. Is this correct? |
Just to clarify one thing: The backward search is only available if you have started Zathura with the proper settings, e.g. |
Thank you for the reply! I am aware, that backward search only works, if zathura is started correctly. That's why I always close zathura when I close neovim, so the sessions don't get mixed up. It's only a problem if there are different files with the same name. As an idea: Could it be possible to use the |
This pretty much implements @stupidus89 's suggestion. Completely untested! |
I pulled your patch and did a quick test. It seems to work with my files. Thank you. |
Ok, I've implemented this based on @andymass's implementation. I used a different regex to instead match the target pdf file. I've tried to escape the necessary characters. I've also filtered the resulting xwin_ids so as not to match any id that is connected to a different buffer. This helps in case one has two different files open in the same Vim instance that has the same file name. I think this should mostly work. However, this feature is difficult to test in a reliable manner, so please let me know how this works. |
I cannot confirm that the new version works. I used the simple minimal example with |
@lervag, just curious, what was the reason to pgrep the filename instead of the servername to find the zathura pid? I think this can't work because no pid will ever be found for that filename, and so xdotool will just use the |
@andymass @stupidus89 Note one thing, though: This might not work as expected if the viewer is started from latexmk. In this particular case, it might work better with the servername as the grep point... |
Ok, I've improved the |
Thank you. It seems to work now. However, I have not tested to use it with different documents within the same vim instance. I always have only one document per terminal. |
That's fine, I've tested here and it seems to work for multiple instances in the same Vim instance as well. Happy to hear that it works. |
Edit
Below is just my original issue. The actual issue is described in #947 (comment).
Explain the issue
I am not sure if this is actually an issue with vimtex, or if it is an issue with neovim or neovim-remote.
I am using the following script to run neovim:
The
Texstartup()
function just does the following:The Neomake command just runs latexmk in continuous mode in the background (see below).
Expected behaviour:
When I run the script on a .tex file, both forward and backward search work with zathura. This actually works most of the time.
Occasionally observed behaviour:
Sometimes, backward search does not work. This problem usually occurs, when I use the script above multiple times and/or for different files. Once it stops working for a certain file, no matter how often I try to run the script on that file again, it will not work, until I reboot my machine.
I noticed there is a difference in the output of
<Leader>li
between when it works and when it does not.If it works, I can see the following:
In case, it does not work:
What is the difference between
cmd
andcmd_forward_search
?Minimal vimrc file
The vimtex related options in my neovim config:
The Neomake command from above:
My
.latexmkrc
:neovim 0.2.0
neovim-remote 1.8.0
vimtex from github
The text was updated successfully, but these errors were encountered: