Skip to content

Inverse search fails on NixOS due to missing runtime path when executing Vim binary directly #3189

@briancarbone

Description

@briancarbone

On NixOS, vimtex procures an executable path like /nix/store/rbpdnv0lxk7y6vz1426x5cm9rbr4bx96-vim-full-523f9f5/bin/.vim-wrapped as in this excerpt from :VimtexInfo:

cmd_start: zathura  -x "/nix/store/rbpdnv0lxk7y6vz1426x5cm9rbr4bx96-vim-full-523f9f5/bin/.vim-wrapped -T dumb --not-a-term -n -c \"VimtexInverseSearch %{line}:%{column} '%{input}'\"" --synctex-forward 1:1:'/home/brian/math/velleman/main.tex' 'main.pdf'&

Also on NixOS, Vim is run via a wrapper script which provides vimrc as an argument (via -u), as seen here:

[~]$ cat $(readlink `which vim`)
#! /nix/store/00zrahbb32nzawrmv9sjxn36h7qk9vrs-bash-5.2p37/bin/bash -e
exec "/nix/store/rjb5y9kx99n13pr74n8fahhfh5lgr0r7-vim-full-651edf3/bin/vim" -N  -u '/nix/store/9q2lf8jfdhrad953kbs6saq6j75dfhsd-vimrc'  "$@"

It seems .vim-wrapped is the binary and not the script, but it prevents inverse search from working correctly because plugins aren't loaded without vimrc containing the runtime path.

Setting g:vimtex_callback_progpath to exepath(v:progname) fixes the issue. Perhaps that should be the default method vimtex uses to obtain the vim command (rather than just v:progname). That would need testing on non-NixOS systems.

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