Skip to content

xwin id for files of the same name in different paths not correctly identified #947

@stupidus89

Description

@stupidus89

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:

#!/bin/sh

ID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
socket=/tmp/nvim-$ID

function finish {
    zatpid=$(ps aux | grep zathura | grep $socket | awk '{print $2}')
    kill $zatpid
}

nvr --servername $socket --remote-silent +":call Texstartup()" $1

trap finish EXIT

The Texstartup() function just does the following:

function! Texstartup()
    Neomake latexmk
    autocmd BufWritePost *.tex :execute "normal \<Plug>(vimtex-view)"
    :execute "normal \<Plug>(vimtex-view)"
endfunction

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:

 viewer: Zathura
    xwin id: 16777219
    process: 
      pid: -
      cmd: zathura -x "nvr --servername /tmp/nvim-GXAG2Vgmt8SCQdzAF2KaRw3qqQ7UWWTt --remote +\%{line} \%{input}" --synctex-forward 1:1:'/path/to/main.tex'  '/path/to/main.pdf' >/dev/null 2>&1 &

In case, it does not work:

viewer: Zathura
    xwin id: 35651587
    cmd_forward_search: zathura --synctex-forward 1:1:'/path/to/main.tex' '/path/to/main.pdf'

What is the difference between cmd and cmd_forward_search?

Minimal vimrc file

The vimtex related options in my neovim config:

let g:vimtex_view_method = "zathura"
let g:vimtex_compiler_progname = "nvr"
let g:tex_flavor = 'latex'
let g:vimtex_imaps_leader='´'

The Neomake command from above:

let g:neomake_tex_latexmk_maker = { 'exe': 'latexmk', 'args': ['-pdf', '-pvc'] }

My .latexmkrc:

$pdflatex = 'pdflatex -interaction=nonstopmode -shell-escape -synctex=1  %O %S';
$pdf_previewer = 'zathura --synctex-forward %O %S &';

neovim 0.2.0
neovim-remote 1.8.0
vimtex from github

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions