From db3a35a116d93162d9bc07264ede37404b243f0a Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 13 Apr 2025 11:14:50 +0200 Subject: [PATCH 1/3] rc: do not set options via luaConfigPre --- modules/wrapper/rc/config.nix | 10 +++++++++- modules/wrapper/rc/options.nix | 26 ++------------------------ 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/modules/wrapper/rc/config.nix b/modules/wrapper/rc/config.nix index ff8a4585..77a62d58 100644 --- a/modules/wrapper/rc/config.nix +++ b/modules/wrapper/rc/config.nix @@ -5,7 +5,7 @@ }: let inherit (builtins) map mapAttrs filter; inherit (lib.attrsets) mapAttrsToList; - inherit (lib.strings) concatLines concatMapStringsSep; + inherit (lib.strings) concatLines concatMapStringsSep optionalString; inherit (lib.trivial) showWarnings; inherit (lib.generators) mkLuaInline; inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere; @@ -72,6 +72,14 @@ in { dag = cfg.luaConfigRC; mapResult = result: concatLines [ + (optionalString (cfg.additionalRuntimePaths != []) '' + vim.opt.runtimepath:append(${toLuaObject cfg.additionalRuntimePaths}) + '') + (optionalString cfg.enableLuaLoader '' + if vim.loader then + vim.loader.enable() + end + '') cfg.luaConfigPre (concatMapStringsSep "\n" mkLuarcSection result) cfg.luaConfigPost diff --git a/modules/wrapper/rc/options.nix b/modules/wrapper/rc/options.nix index 4cd3026f..10abd77d 100644 --- a/modules/wrapper/rc/options.nix +++ b/modules/wrapper/rc/options.nix @@ -1,15 +1,7 @@ -{ - config, - lib, - ... -}: let +{lib, ...}: let inherit (lib.options) mkOption literalMD literalExpression; - inherit (lib.strings) optionalString; inherit (lib.types) str bool int enum attrsOf lines listOf either path submodule anything; inherit (lib.nvim.types) dagOf; - inherit (lib.nvim.lua) listToLuaTable; - - cfg = config.vim; in { options.vim = { enableLuaLoader = mkOption { @@ -286,21 +278,7 @@ in { luaConfigPre = mkOption { type = str; - default = '' - ${optionalString (cfg.additionalRuntimePaths != []) '' - -- The following list is generated from `vim.additionalRuntimePaths` - -- and is used to append additional runtime paths to the - -- `runtimepath` option. - vim.opt.runtimepath:append(${listToLuaTable cfg.additionalRuntimePaths}) - ''} - - ${optionalString cfg.enableLuaLoader '' - if vim.loader then - vim.loader.enable() - end - ''} - ''; - + default = ""; defaultText = literalMD '' By default, this option will **append** paths in [](#opt-vim.additionalRuntimePaths) From 1f6e2f3ca461f6d5ffa3f9676362f396eae708ff Mon Sep 17 00:00:00 2001 From: Ching Pei Yang Date: Sun, 13 Apr 2025 11:32:11 +0200 Subject: [PATCH 2/3] docs: update release notes --- docs/release-notes/rl-0.8.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 642599ba..e866e969 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -107,6 +107,8 @@ - Add `LazyFile` user event. - Migrate language modules from none-ls to conform/nvim-lint - Add tsx support in conform and lint +- Moved code setting additionalRuntimePaths and enableLuaLoader out of + luaConfigPre's default to prevent being overridden [diniamo](https://github.com/diniamo): From 46979fd94fc544b64819b7aaa7cb73c2d3ea0292 Mon Sep 17 00:00:00 2001 From: raf Date: Mon, 21 Apr 2025 06:54:30 +0000 Subject: [PATCH 3/3] docs: format options as inline code --- docs/release-notes/rl-0.8.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index f993a9e5..5dc3ca94 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -107,8 +107,8 @@ - Add `LazyFile` user event. - Migrate language modules from none-ls to conform/nvim-lint - Add tsx support in conform and lint -- Moved code setting additionalRuntimePaths and enableLuaLoader out of - luaConfigPre's default to prevent being overridden +- Moved code setting `additionalRuntimePaths` and `enableLuaLoader` out of + `luaConfigPre`'s default to prevent being overridden [diniamo](https://github.com/diniamo):