diff --git a/configuration.nix b/configuration.nix index df0b2b1c..261d5555 100644 --- a/configuration.nix +++ b/configuration.nix @@ -55,7 +55,6 @@ isMaximal: { ts.enable = isMaximal; svelte.enable = isMaximal; go.enable = isMaximal; - lua.enable = isMaximal; elixir.enable = isMaximal; zig.enable = isMaximal; ocaml.enable = isMaximal; diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index f8cec50f..de0033db 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -93,9 +93,6 @@ everyone. - Add dap-go for better dap configurations - Make noice.nvim customizable - Standardize border style options and add custom borders -- Remove `vim.disableDefaultRuntimePaths` in wrapper options. - - As nvf uses `$NVIM_APP_NAME` as of recent changes, we can safely assume any - configuration in `$XDG_CONFIG_HOME/nvf` is intentional. [rust-tools.nvim]: https://github.com/simrat39/rust-tools.nvim [rustaceanvim]: https://github.com/mrcjkb/rustaceanvim @@ -273,5 +270,4 @@ everyone. [ksonj](https://github.com/ksonj): -- Add LSP support for Scala via - [nvim-metals](https://github.com/scalameta/nvim-metals) +- Add LSP support for Scala via [nvim-metals](https://github.com/scalameta/nvim-metals) diff --git a/modules/extra/deprecations.nix b/modules/extra/deprecations.nix index 779a7527..c4ff4d30 100644 --- a/modules/extra/deprecations.nix +++ b/modules/extra/deprecations.nix @@ -35,19 +35,5 @@ in { vim.snippets.vsnip.enable has been removed in favor of the more modern luasnip. '') (mkRenamedOptionModule ["vim" "lsp" "lspkind" "mode"] ["vim" "lsp" "lspkind" "setupOpts" "mode"]) - - # 2024-10-14 - (mkRemovedOptionModule ["vim" "configRC"] '' - Please migrate your configRC sections to Neovim's Lua format, and - add them to `vim.luaConfigRC`. - - See the v0.7 release notes for more information on why and how to - migrate your existing configurations to the new format. - '') - - (mkRemovedOptionModule ["vim" "disableDefaultRuntimePaths"] '' - Nvf now uses $NVIM_APP_NAME so there is no longer the problem of - (accidental) leaking of user configuration. - '') ]; } diff --git a/modules/wrapper/rc/options.nix b/modules/wrapper/rc/options.nix index 1159b9fe..70ab2a8a 100644 --- a/modules/wrapper/rc/options.nix +++ b/modules/wrapper/rc/options.nix @@ -3,18 +3,27 @@ lib, ... }: let + inherit (lib.modules) mkRemovedOptionModule; inherit (lib.options) mkOption mkEnableOption literalMD literalExpression; inherit (lib.strings) optionalString; - inherit (lib.types) str attrs lines listOf either path; + inherit (lib.types) str attrs lines listOf either path bool; inherit (lib.nvim.types) dagOf; inherit (lib.nvim.lua) listToLuaTable; cfg = config.vim; in { + imports = [ + (mkRemovedOptionModule ["vim" "configRC"] '' + Please migrate your configRC sections to Neovim's Lua format, and + add them to luaConfigRC. + + See the v0.7 release notes for more information on how to migrate + your existing configurations. + '') + ]; + options.vim = { enableLuaLoader = mkEnableOption '' - [{option}`official documentation`]: https://neovim.io/doc/user/lua.html#vim.loader.enable() - the experimental Lua module loader to speed up the start up process If `true`, this will enable the experimental Lua module loader which: @@ -23,12 +32,30 @@ in { - adds the libs loader - removes the default Neovim loader - ::: {.note} This is disabled by default. Before setting this option, please - take a look at the [{option}`official documentation`]. - ::: + 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. {file}`$HOME/.config/nvim`, {file}`$HOME/.config/nvim/after` + and {file}`$HOME/.local/share/nvim/site`) you may set this + option to true. + ::: + ''; + }; + additionalRuntimePaths = mkOption { type = listOf (either path str); default = []; @@ -153,6 +180,21 @@ in { vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths}) ''} + ${optionalString cfg.disableDefaultRuntimePaths '' + -- Remove default user runtime paths from the + -- `runtimepath` option to avoid leaking user configuration + -- into the final neovim wrapper + 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()"} '';