diff --git a/docs/release-notes/rl-0.8.md b/docs/release-notes/rl-0.8.md index 5dc3ca94..2800789f 100644 --- a/docs/release-notes/rl-0.8.md +++ b/docs/release-notes/rl-0.8.md @@ -107,8 +107,6 @@ - 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): diff --git a/modules/neovim/init/autocmds.nix b/modules/neovim/init/autocmds.nix index 81580e6b..5da7bc55 100644 --- a/modules/neovim/init/autocmds.nix +++ b/modules/neovim/init/autocmds.nix @@ -17,7 +17,7 @@ mkEnableOption "" // { default = true; - description = "Whether to enable this autocommand."; + description = "Whether to enable this autocommand"; }; event = mkOption { @@ -31,7 +31,7 @@ type = nullOr (listOf str); default = null; example = ["*.lua" "*.vim"]; - description = "The file pattern(s) that determine when the autocommand applies."; + description = "The file pattern(s) that determine when the autocommand applies)."; }; callback = mkOption { @@ -44,16 +44,13 @@ end '''' ''; - description = "Lua function to be called when the event(s) are triggered."; + description = "The file pattern(s) that determine when the autocommand applies."; }; command = mkOption { type = nullOr str; default = null; - description = '' - Vim command to be executed when the event(s) are triggered. - Cannot be defined if the `callback` option is already defined. - ''; + description = "Vim command string instead of a Lua function."; }; group = mkOption { @@ -73,7 +70,7 @@ once = mkOption { type = bool; default = false; - description = "Whether to run the autocommand only once."; + description = "Whether autocommand run only once."; }; nested = mkOption { @@ -90,7 +87,7 @@ mkEnableOption "" // { default = true; - description = "Whether to enable this autocommand group."; + description = "Whether to enable this autogroup"; }; name = mkOption { @@ -121,8 +118,8 @@ in { autocommands together. Groups allow multiple autocommands to be cleared or redefined collectively, preventing duplicate definitions. - Each autogroup consists of a name and a boolean indicating whether to clear - existing autocommands. + Each autogroup consists of a name, a boolean indicating whether to clear + existing autocommands, and a list of associated autocommands. ''; }; @@ -132,8 +129,8 @@ in { description = '' A list of Neovim autocommands to be registered. - Each entry defines an autocommand, specifying events, patterns, a callback or Vim - command, an optional group, a description, and execution settings. + Each entry defines an autocommand, specifying events, patterns, optional + callbacks, commands, groups, and execution settings. ''; }; }; diff --git a/modules/plugins/assistant/chatgpt/config.nix b/modules/plugins/assistant/chatgpt/config.nix index b1066e5a..95a36acf 100644 --- a/modules/plugins/assistant/chatgpt/config.nix +++ b/modules/plugins/assistant/chatgpt/config.nix @@ -30,16 +30,7 @@ in { config = mkIf cfg.enable { vim = { - startPlugins = [ - "chatgpt-nvim" - - # Dependencies - "nui-nvim" - "plenary-nvim" - ]; - - # ChatGPT.nvim explicitly depends on Telescope. - telescope.enable = true; + startPlugins = ["chatgpt-nvim"]; pluginRC.chagpt = entryAnywhere '' require("chatgpt").setup(${toLuaObject cfg.setupOpts}) diff --git a/modules/wrapper/rc/config.nix b/modules/wrapper/rc/config.nix index 77a62d58..ff8a4585 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 optionalString; + inherit (lib.strings) concatLines concatMapStringsSep; inherit (lib.trivial) showWarnings; inherit (lib.generators) mkLuaInline; inherit (lib.nvim.dag) entryAfter mkLuarcSection resolveDag entryAnywhere; @@ -72,14 +72,6 @@ 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 10abd77d..4cd3026f 100644 --- a/modules/wrapper/rc/options.nix +++ b/modules/wrapper/rc/options.nix @@ -1,7 +1,15 @@ -{lib, ...}: let +{ + config, + 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 { @@ -278,7 +286,21 @@ in { luaConfigPre = mkOption { type = str; - default = ""; + 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 + ''} + ''; + defaultText = literalMD '' By default, this option will **append** paths in [](#opt-vim.additionalRuntimePaths)