feat: apply new module format to markdown plugins

This commit is contained in:
NotAShelf 2023-02-27 22:26:00 +03:00
parent 067b523897
commit 4434d9e053
No known key found for this signature in database
GPG key ID: 5B5C8895F28445F1
6 changed files with 69 additions and 42 deletions

View file

@ -0,0 +1,13 @@
{
pkgs,
config,
lib,
...
}:
with lib; {
config = {
vim.markdown = {
enable = mkDefault false;
};
};
}

View file

@ -6,5 +6,7 @@
}: { }: {
imports = [ imports = [
./glow ./glow
./config.nix
./module.nix
]; ];
} }

View file

@ -4,11 +4,17 @@
lib, lib,
... ...
}: }:
with lib; { with lib; let
config = { cfg = config.vim.markdown.glow;
vim.markdown = { in {
enable = mkDefault false; config = (mkIf cfg.enable) {
glow.enable = mkDefault false; vim.startPlugins = ["glow-nvim"];
vim.globals = {
"glow_binary_path" = "${pkgs.glow}/bin";
}; };
vim.configRC.glow = nvim.dag.entryAnywhere ''
autocmd FileType markdown noremap <leader>p :Glow<CR>
'';
}; };
} }

View file

@ -1,38 +1,6 @@
{ _: {
pkgs, imports = [
config, ./glow.nix
lib, ./config.nix
...
}:
with lib;
with builtins; let
cfg = config.vim.markdown;
in {
options.vim.markdown = {
enable = mkEnableOption "markdown tools and plugins";
glow.enable = mkOption {
type = types.bool;
default = true;
description = "Enable markdown preview in neovim with glow";
};
};
config = mkIf (cfg.enable) {
vim.startPlugins = [
(
if cfg.glow.enable
then "glow-nvim"
else null
)
]; ];
vim.globals = mkIf (cfg.glow.enable) {
"glow_binary_path" = "${pkgs.glow}/bin";
};
vim.configRC.glow = mkIf (cfg.glow.enable) (nvim.dag.entryAnywhere ''
autocmd FileType markdown noremap <leader>p :Glow<CR>
'');
};
} }

View file

@ -0,0 +1,18 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.markdown;
in {
options.vim.markdown = {
glow.enable = mkOption {
type = types.bool;
default = false;
description = "Enable markdown preview in neovim with glow";
};
};
}

View file

@ -0,0 +1,20 @@
{
pkgs,
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.markdown;
in {
options.vim.markdown = {
enable = mkEnableOption "markdown tools and plugins";
};
config = mkIf (cfg.enable) {
/*
...
*/
};
}