2024-02-13 12:33:10 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
2024-03-24 00:14:39 +00:00
|
|
|
inherit (lib.modules) mkIf mkMerge;
|
2024-04-14 14:20:30 +00:00
|
|
|
inherit (lib.nvim.binds) mkBinding pushDownDefault;
|
2024-03-24 00:14:39 +00:00
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
2024-02-13 12:33:10 +00:00
|
|
|
|
|
|
|
cfg = config.vim.utility.preview.glow;
|
|
|
|
self = import ./glow.nix {
|
|
|
|
inherit lib config pkgs;
|
|
|
|
};
|
|
|
|
mappings = self.options.vim.utility.preview.glow.mappings;
|
|
|
|
in {
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
vim.startPlugins = ["glow-nvim"];
|
|
|
|
|
|
|
|
vim.maps.normal = mkMerge [
|
2024-02-13 14:45:47 +00:00
|
|
|
(mkBinding cfg.mappings.openPreview ":Glow<CR>" mappings.openPreview.description)
|
2024-02-13 12:33:10 +00:00
|
|
|
];
|
|
|
|
|
2024-02-26 03:52:21 +00:00
|
|
|
vim.binds.whichKey.register = pushDownDefault {
|
2024-02-25 16:39:05 +00:00
|
|
|
"<leader>pm" = "+Preview Markdown";
|
|
|
|
};
|
|
|
|
|
2024-03-24 00:14:39 +00:00
|
|
|
vim.luaConfigRC.glow = entryAnywhere ''
|
2024-02-13 12:33:10 +00:00
|
|
|
require('glow').setup({
|
2024-02-13 14:45:47 +00:00
|
|
|
glow_path = "${pkgs.glow}/bin/glow"
|
|
|
|
});
|
2024-02-13 12:33:10 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|