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:
raf 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

View file

@ -49,8 +49,17 @@ in {
default = []; default = [];
example = literalExpression '' example = literalExpression ''
[ [
"$HOME/.config/nvim-extra" # absolute path, as a string - impure # absolute path, as a string - impure
./nvim # relative path, as a path - pure "$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 -- Remove default user runtime paths from the
-- `runtimepath` option to avoid leaking user configuration -- `runtimepath` option to avoid leaking user configuration
-- into the final neovim wrapper -- into the final neovim wrapper
vim.opt.runtimepath:remove(vim.fn.stdpath('config')) -- $HOME/.config/nvim local defaultRuntimePaths = {
vim.opt.runtimepath:remove(vim.fn.stdpath('config') .. "/after") -- $HOME/.config/nvim/after vim.fn.stdpath('config'), -- $HOME/.config/nvim
vim.opt.runtimepath:remove(vim.fn.stdpath('data') .. "/site") -- $HOME/.local/share/nvim/site 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()"} ${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
@ -134,9 +149,9 @@ in {
defaultText = literalMD '' defaultText = literalMD ''
By default, this option will **append** paths in 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 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}"''; example = literalExpression ''"$${builtins.readFile ./my-lua-config-pre.lua}"'';