mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-09-06 02:11:33 +00:00
refactor(markdown): glow gets its own directory
This commit is contained in:
parent
3dcc1addd2
commit
61d497e9ce
3 changed files with 1 additions and 2 deletions
14
modules/markdown/glow/config.nix
Normal file
14
modules/markdown/glow/config.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; {
|
||||
config = {
|
||||
vim.markdown = {
|
||||
enable = mkDefault false;
|
||||
glow.enable = mkDefault false;
|
||||
};
|
||||
};
|
||||
}
|
38
modules/markdown/glow/default.nix
Normal file
38
modules/markdown/glow/default.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
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>
|
||||
'');
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue