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")