Neovim runtimepath broken?

I expect the same behaviour of syntax highlighting for PHP files when opening a PHP file within neovim.
I receive a different highlighting.

I’m using a pinned version of the PHP syntax plugin and my own colour scheme. So it is impossible that they have changed.

Still I get completely different highlighting. I’ve debugged hat the syntax groups are different. Also, the runtimepath differs between a working and broken generation. The working generation loaded these two paths first:

  • /nix/store/4j4kvsw4zlaxnm0fd7di0a82912rl9ly-vim-pack-dir
  • /nix/store/4j4kvsw4zlaxnm0fd7di0a82912rl9ly-vim-pack-dir/pack//start/

These are now missing in newer broken versions.

I’m running Ubuntu with nix (2.10.3) + home-manager (22.05) installed using nix-channels. The switch happened between “2022-08-01 08:03” and “2022-08-15 10:10”.

Where can I debug? I tried to check changes to some files like modules/programs/neovim.nix from home-manager as well as some related files from nixpkgs but couldn’t find any related change.

The output of nvd is also not showing related changes:

Version changes:
[U.]  #01  alsa-lib                     1.2.7.1 -> 1.2.7.2
[U.]  #02  botan                        2.18.1 -> 2.19.2
[U.]  #03  bundler                      2.3.9 -> 2.3.20
[U.]  #04  chromium                     103.0.5060.134, 103.0.5060.134-sandbox -> 104.0.5112.79, 104.0.5112.79-sandbox
[U.]  #05  chromium-unwrapped           103.0.5060.134, 103.0.5060.134-sandbox -> 104.0.5112.79, 104.0.5112.79-sandbox
[U.]  #06  firefox                      103.0 -> 103.0.2
[U.]  #07  firefox-unwrapped            103.0 -> 103.0.2
[U.]  #08  fluidsynth                   2.2.7 -> 2.2.8
[U.]  #09  getent-glibc                 2.34-210 -> 2.35-163
[U.]  #10  glibc                        2.34-210, 2.34-210-bin -> 2.35-163, 2.35-163-bin, 2.35-163-dev
[U.]  #11  glibc-locales                2.34-210 -> 2.35-163
[U.]  #12  harfbuzz                     3.3.2 -> 5.0.1
[U.]  #13  harfbuzz-icu                 3.3.2 -> 5.0.1
[U.]  #14  libupnp                      1.14.12 -> 1.14.13
[U.]  #15  libva                        2.14.0 -> 2.15.0
[U.]  #16  libwacom                     2.2.0 -> 2.4.0
[C.]  #17  neovim                       0.7.2 x2 -> 0.7.2
[U.]  #18  net-snmp                     5.9.1, 5.9.1-lib -> 5.9.3, 5.9.3-lib
[U.]  #19  nettle                       3.7.3 -> 3.8
[U.]  #20  networkmanager               1.38.2 -> 1.38.4
[U.]  #21  nextcloud-client             3.5.3 -> 3.5.4
[U.]  #22  openal-soft                  1.22.0 -> 1.22.2
[U.]  #23  openldap                     2.6.2 -> 2.6.3
[U.]  #24  perl5.34.1-libwww-perl       6.49 -> 6.67
[C.]  #25  php                          8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #26  php-bcmath                   8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #27  php-calendar                 8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #28  php-ctype                    8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #29  php-curl                     8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #30  php-dom                      8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #31  php-exif                     8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #32  php-extra-init               8.0.21.ini, 8.1.8.ini -> 8.0.22.ini, 8.1.9.ini
[C.]  #33  php-fileinfo                 8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #34  php-filter                   8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #35  php-ftp                      8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #36  php-gd                       8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #37  php-gettext                  8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #38  php-gmp                      8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #39  php-iconv                    8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #40  php-imap                     8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #41  php-intl                     8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #42  php-ldap                     8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #43  php-mbstring                 8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #44  php-mysqli                   8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #45  php-mysqlnd                  8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #46  php-opcache                  8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #47  php-openssl                  8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #48  php-pcntl                    8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #49  php-pdo                      8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #50  php-pdo_mysql                8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #51  php-pdo_odbc                 8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #52  php-pdo_pgsql                8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #53  php-pdo_sqlite               8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #54  php-pgsql                    8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #55  php-posix                    8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #56  php-readline                 8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #57  php-session                  8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #58  php-simplexml                8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #59  php-soap                     8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #60  php-sockets                  8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #61  php-sodium                   8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #62  php-sqlite3                  8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #63  php-tokenizer                8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #64  php-with-extensions          8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #65  php-xmlreader                8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #66  php-xmlwriter                8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #67  php-zip                      8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[C.]  #68  php-zlib                     8.0.21, 8.1.8 -> 8.0.22, 8.1.9
[U.]  #69  poppler-glib                 22.06.0 -> 22.08.0
[U.]  #70  python3.10-jarowinkler       1.1.2 -> 1.2.0
[U.]  #71  python3.10-pygobject         3.42.1 -> 3.42.2
[U.]  #72  python3.10-rapidfuzz         2.1.3 -> 2.4.3
[U.]  #73  python3.10-yt-dlp            2022.07.18 -> 2022.8.8
[U.]  #74  signal-desktop               5.52.0 -> 5.54.0
[U.]  #75  sndio                        1.8.1 -> 1.9.0
[U.]  #76  sqlite                       3.39.1, 3.39.1-bin -> 3.39.2, 3.39.2-bin
[U.]  #77  sumneko-lua-language-server  3.4.1 -> 3.5.3
Added packages:
[A.]  #1  hm_auth.json                                                 <none>
[A.]  #2  hm_composerupdatechannel                                     <none>
[A.]  #3  linux-headers                                                5.18
[A.]  #4  vimplugin-phpactor-e7d404c2c6fbe606e5a6374b8e3d0c0d0430487f  <none>
Removed packages:
[R.]  #1  mcfly                                                        0.6.0
[R.]  #2  vimplugin-phpactor-f07b2a65e3b5f84c49a76fadb9752f8cafd7e879  <none>
Closure size: 1171 -> 1173 (1147 paths added, 1145 paths removed, delta +2).

I guess this is related to neovim: pass packpath via the wrapper · NixOS/nixpkgs@cda1f8a · GitHub. Not sure if this is a regression issue or if I need to modify anything on my end … :confused: So probably not to much related to nix but more to neovim/vim.

Could it be this?
Edit: perhaps not, that mentions it shouldn’t affect home-manager installed neovim.

Plugins are loaded. I fear the loading order has changed.

what if you add "--cmd" "set rtp^=${vimUtils.packDir packDirArgs}" to neovim: pass packpath via the wrapper · NixOS/nixpkgs@cda1f8a · GitHub

The idea of the PR is to set packpath via the command line so we dont have to write an init.vim anymore (and so we can load an init.lua instead).
In case of neovim rtp isnt set anymore (packpath should be used to generate the rtp by neovim) but maybe that causes the issue you see.

(which could affect the home-manager install too)

Hey @teto thank you. Adding the cmd option solved the issue. Not sure what exactly is happening. I never fiddled with packagepath or runtimepath myself. I used pathogen before using home-manager.

Most things seem to work just fine. I might lack some understanding on vim itself here. As written above: I have an own copy of the php-syntax added via home-manager and it seems this is not taking to affect (unless I add it to runtimepath).

I found plugin system - Order in runtimepath of Vim packages or similar plug-in managers - Vi and Vim Stack Exchange while researching but that didn’t help me to understand the real issue.

I would guess the issue shouldn’t be the missing rtp, but my own setup? But I’d also say I’m not doing something fancy. I add a PHP syntax plugin and add configuration for it: nixpkgs/neovim.nix at main - nixpkgs - Gitea of Daniel Siepmann

I don’t have enough insights into neovim itself. But it seems setting the packpath via --cmd doesn’t add it to runtimepath at the right position, but after neovim runtime itself.

That’s why syntax files delivered by neovim will win. I’ve now fixed for myself by adding the syntax file to XDG_CONFIG ~/.config/nvim/syntax/php.vim as this is always loaded first.
That’s fine for my use case as the file is no longer maintained.

Still this is a workaround instead of a fix.

My wrapped neovim has been broken by some of the new changes source

nix build github:viperML/dotfiles/59c63c26b35fd41c2e691421b212c3de72da7ec8#neovim

It seems that packpath is now passed as an argument, but points to some package that is not the package that I specifiy in my override. Its name is myNeovimPackages.

nix build github:viperML/dotfiles/dc3504c0543d1b21fd911477289003d0bd96e41f#neovim

This is my wrapped neovim just after updating. The packpath is set in the init.vim and points to the right directory

It seems that changing my config to use makeNeovimConfig 's plugins , instead of packages.placeholder.start works for me. Should the nixpkgs manual be updated to reflect this behavour?

neovim.override uses wrapNeovimUnstable via some glue code with the hope to remain backwards compatible. I would be interested to know if your issue is nixpkgs-related or just some bad interactions with your config. Nixpkgs now sets packpath via --cmd which is executed before running your init.vim so it shouldn’t change anything (nixpkgs doesnt set the runtimepath anymore but it should be generated from packpath by neovim anyway).

Hosted by Flying Circus.