utility/glow: migrate to setupOpts API

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I7d50f183037f3b983a7c79aee1113d516a6a6964
This commit is contained in:
raf 2026-06-20 01:24:55 +03:00
commit f3c3353ced
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
2 changed files with 14 additions and 5 deletions

View file

@ -1,5 +1,4 @@
{ {
pkgs,
config, config,
lib, lib,
options, options,
@ -8,6 +7,7 @@
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.nvim.binds) mkKeymap pushDownDefault; inherit (lib.nvim.binds) mkKeymap pushDownDefault;
inherit (lib.nvim.dag) entryAnywhere; inherit (lib.nvim.dag) entryAnywhere;
inherit (lib.nvim.lua) toLuaObject;
cfg = config.vim.utility.preview.glow; cfg = config.vim.utility.preview.glow;
inherit (options.vim.utility.preview.glow) mappings; inherit (options.vim.utility.preview.glow) mappings;
@ -24,9 +24,7 @@ in {
}; };
pluginRC.glow = entryAnywhere '' pluginRC.glow = entryAnywhere ''
require('glow').setup({ require('glow').setup(${toLuaObject cfg.setupOpts})
glow_path = "${pkgs.glow}/bin/glow"
});
''; '';
}; };
} }

View file

@ -1,10 +1,13 @@
{ {
config, config,
pkgs,
lib, lib,
... ...
}: let }: let
inherit (lib.modules) mkRenamedOptionModule; inherit (lib.modules) mkRenamedOptionModule;
inherit (lib.options) mkEnableOption; inherit (lib.options) mkEnableOption mkOption;
inherit (lib.types) str;
inherit (lib.nvim.types) mkPluginSetupOption;
inherit (config.vim.lib) mkMappingOption; inherit (config.vim.lib) mkMappingOption;
in { in {
imports = [ imports = [
@ -15,6 +18,14 @@ in {
glow = { glow = {
enable = mkEnableOption "markdown preview in neovim with glow"; enable = mkEnableOption "markdown preview in neovim with glow";
mappings.openPreview = mkMappingOption "Open preview" "<leader>p"; mappings.openPreview = mkMappingOption "Open preview" "<leader>p";
setupOpts = mkPluginSetupOption "glow.nvim" {
glow_path = mkOption {
type = str;
default = "${pkgs.glow}/bin/glow";
example = "glow";
description = "Path to the glow binary.";
};
};
}; };
}; };
} }