wrapper/rc: loop over removed runtime paths

Would be neat to expose removed paths as a list in the future
This commit is contained in:
NotAShelf 2024-04-23 21:10:39 +03:00
parent 2680be20a3
commit 4b868d0de6
No known key found for this signature in database
GPG Key ID: 02D1DD3FA08B6B29
1 changed files with 22 additions and 7 deletions

View File

@ -49,8 +49,17 @@ in {
default = [];
example = literalExpression ''
[
"$HOME/.config/nvim-extra" # absolute path, as a string - impure
./nvim # relative path, as a path - pure
# absolute path, as a string - impure
"$HOME/.config/nvim-extra"
# relative path, as a path - pure
./nvim
# source type path - pure and reproducible
(builtins.source {
path = ./runtime;
name = "nvim-runtime";
})
]
'';
@ -124,9 +133,15 @@ in {
-- Remove default user runtime paths from the
-- `runtimepath` option to avoid leaking user configuration
-- into the final neovim wrapper
vim.opt.runtimepath:remove(vim.fn.stdpath('config')) -- $HOME/.config/nvim
vim.opt.runtimepath:remove(vim.fn.stdpath('config') .. "/after") -- $HOME/.config/nvim/after
vim.opt.runtimepath:remove(vim.fn.stdpath('data') .. "/site") -- $HOME/.local/share/nvim/site
local defaultRuntimePaths = {
vim.fn.stdpath('config'), -- $HOME/.config/nvim
vim.fn.stdpath('config') .. "/after", -- $HOME/.config/nvim/after
vim.fn.stdpath('data') .. "/site", -- $HOME/.local/share/nvim/site
}
for _, path in ipairs(defaultRuntimePaths) do
vim.opt.runtimepath:remove(path)
end
''}
${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
@ -134,9 +149,9 @@ in {
defaultText = literalMD ''
By default, this option will **append** paths in
[vim.additionalRuntimePaths](#opt-vim.additionalRuntimePaths)
[](#opt-vim.additionalRuntimePaths)
to the `runtimepath` and enable the experimental Lua module loader
if [vim.enableLuaLoader](#opt-vim.enableLuaLoader) is set to true.
if [](#opt-vim.enableLuaLoader) is set to true.
'';
example = literalExpression ''"$${builtins.readFile ./my-lua-config-pre.lua}"'';