From 2936e2c8b9cb244292edd289d7074b6bfc70341d Mon Sep 17 00:00:00 2001 From: Andre Silva Date: Thu, 19 Feb 2026 18:38:46 +0000 Subject: [PATCH] fixes help-buffer Treesitter failures on distro Neovim packages that place parsers in or --- init.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/init.lua b/init.lua index e861b68ca..5dc5423b6 100644 --- a/init.lua +++ b/init.lua @@ -1,6 +1,22 @@ vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46/" vim.g.mapleader = " " +local function ensure_system_parsers_on_rtp() + if #vim.api.nvim_get_runtime_file("parser/vimdoc.*", false) > 0 then + return + end + + for _, dir in ipairs { "/usr/lib/nvim", "/usr/lib64/nvim" } do + if vim.uv.fs_stat(dir .. "/parser") then + vim.opt.rtp:append(dir) + return + end + end +end + +-- Distro packages may ship parsers under /usr/lib*/nvim instead of runtime/. +ensure_system_parsers_on_rtp() + -- bootstrap lazy and all plugins local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim" @@ -25,6 +41,9 @@ require("lazy").setup({ { import = "plugins" }, }, lazy_config) +-- lazy can rewrite rtp, so restore system parser path after setup too. +ensure_system_parsers_on_rtp() + -- load theme dofile(vim.g.base46_cache .. "defaults") dofile(vim.g.base46_cache .. "statusline")