Skip to content

fix: restore system parser runtime path when vimdoc parser is missing#108

Open
mastersilvapt wants to merge 1 commit intoNvChad:mainfrom
mastersilvapt:main
Open

fix: restore system parser runtime path when vimdoc parser is missing#108
mastersilvapt wants to merge 1 commit intoNvChad:mainfrom
mastersilvapt:main

Conversation

@mastersilvapt
Copy link
Copy Markdown

This fixes help-buffer Treesitter failures on distro Neovim packages that place parsers in /usr/lib/nvim or /usr/lib64/nvim.

Why

lazy.setup() can rewrite runtimepath, and on some systems that drops /usr/lib/nvim.
Then builtin Treesitter cannot find parser/vimdoc.so, so :help fails with:
Parser could not be created ... language "vimdoc".

What

  • Add a small guard in init.lua:
    • If parser/vimdoc.* is not found on current rtp, append /usr/lib/nvim or /usr/lib64/nvim if present.
  • Run this guard:
    • before lazy.setup()
    • after lazy.setup() (because rtp can be rewritten there)

This is a no-op on systems where parser is already discoverable.

Validation

  • nvim --headless '+h vim.lsp.config' +qall no longer errors
  • nvim_get_runtime_file("parser/vimdoc.*", false) returns system parser path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant