Merge branch 'main' into fix-highlight-color-type

This commit is contained in:
raf 2025-04-23 19:36:13 +00:00 committed by GitHub
commit 43421d5612
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 91 additions and 28 deletions

View file

@ -30,7 +30,16 @@
in {
config = mkIf cfg.enable {
vim = {
startPlugins = ["chatgpt-nvim"];
startPlugins = [
"chatgpt-nvim"
# Dependencies
"nui-nvim"
"plenary-nvim"
];
# ChatGPT.nvim explicitly depends on Telescope.
telescope.enable = true;
pluginRC.chagpt = entryAnywhere ''
require("chatgpt").setup(${toLuaObject cfg.setupOpts})

View file

@ -9,7 +9,7 @@
inherit (lib.modules) mkIf mkMerge;
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.lists) isList;
inherit (lib.types) bool enum either package listOf str;
inherit (lib.types) bool enum either package listOf str nullOr;
inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.types) diagnostics mkGrammarOption mkPluginSetupOption;
inherit (lib.nvim.dag) entryAnywhere;
@ -117,7 +117,18 @@ in {
'';
};
setupOpts = mkPluginSetupOption "render-markdown" {};
setupOpts = mkPluginSetupOption "render-markdown" {
file_types = lib.mkOption {
type = nullOr (listOf str);
default = null;
description = ''
List of buffer filetypes to enable this plugin in.
This will cause the plugin to attach to new buffers who
have any of these filetypes.
'';
};
};
};
};

View file

@ -0,0 +1,19 @@
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.mini.cursorword;
in {
vim = mkIf cfg.enable {
startPlugins = ["mini-cursorword"];
pluginRC.mini-ai = entryAnywhere ''
require("mini.cursorword").setup(${toLuaObject cfg.setupOpts})
'';
};
}

View file

@ -0,0 +1,9 @@
{lib, ...}: let
inherit (lib.options) mkEnableOption;
inherit (lib.nvim.types) mkPluginSetupOption;
in {
options.vim.mini.cursorword = {
enable = mkEnableOption "mini.cursorword";
setupOpts = mkPluginSetupOption "mini.cursorword" {};
};
}

View file

@ -0,0 +1,6 @@
{
imports = [
./cursorword.nix
./config.nix
];
}

View file

@ -11,6 +11,7 @@
./colors
./comment
./completion
./cursorword
./diff
./doc
./extra

View file

@ -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

View file

@ -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)