wrapper/rc: ignore user directories by default

This commit is contained in:
raf 2024-04-21 02:59:18 +03:00
parent be0fd17510
commit fecf9f48be
No known key found for this signature in database
GPG key ID: 02D1DD3FA08B6B29

View file

@ -24,6 +24,26 @@ in {
take a look at the [{option}`official documentation`](https://neovim.io/doc/user/lua.html#vim.loader.enable()).
'';
disableDefaultRuntimePaths = mkOption {
type = bool;
default = true;
example = false;
description = ''
Disables the default runtime paths that are set by Neovim
when it starts up. This is useful when you want to have
full control over the runtime paths that are set by Neovim.
::: {.note}
To avoid leaking imperative user configuration into your
configuration, this is enabled by default. If you wish
to load configuration from user configuration directories
(e.g. `$HOME/.config/nvim`, `$HOME/.config/nvim/after`
and `$HOME/.local/share/nvim/site`) you may set this
option to true.
:::
'';
};
additionalRuntimePaths = mkOption {
type = listOf (either path str);
default = [];
@ -90,6 +110,15 @@ in {
end
''}
${optionalString cfg.disableDefaultRuntimePaths ''
-- 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
''}
${optionalString cfg.enableLuaLoader "vim.loader.enable()"}
'';