Skip to content

Commit

Permalink
set up render-markdown.nvim plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
gvolpe committed Sep 17, 2024
1 parent 1058973 commit 69a19b5
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 56 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Nix flake for [neovim](https://neovim.io/) with configuration options highly foc

## Documentation

- [https://gvolpe.com/neovim-flake](https://gvolpe.com/neovim-flake).
- [gvolpe.com/neovim-flake](https://gvolpe.com/neovim-flake)

## Credits

Expand Down
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@
flake = false;
};

render-markdown-nvim = {
url = github:MeanderingProgrammer/render-markdown.nvim;
flake = false;
};

# Organized notes in trees
mind-nvim = {
url = github:gvolpe/mind.nvim;
Expand Down
1 change: 1 addition & 0 deletions lib/ide.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ let
markdown = {
enable = true;
glow.enable = true;
render.enable = true;
};
git = {
enable = true;
Expand Down
12 changes: 0 additions & 12 deletions modules/markdown/config.nix

This file was deleted.

54 changes: 49 additions & 5 deletions modules/markdown/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,52 @@
{ ... }:
{ pkgs, config, lib, ... }:

with lib;
with builtins;

let
cfg = config.vim.markdown;
in
{
imports = [
./config.nix
./glow.nix
];
options.vim.markdown = {
enable = mkEnableOption "markdown tools and plugins";

glow.enable = mkOption {
type = types.bool;
default = false;
description = "Enable markdown preview in neovim with glow";
};

render.enable = mkOption {
type = types.bool;
default = false;
description = "Enable render-markdown.nvim plugin";
};
};

config = mkIf cfg.enable {
vim.startPlugins =
withPlugins cfg.glow.enable [ pkgs.neovimPlugins.glow-nvim ] ++
withPlugins cfg.render.enable [ pkgs.neovimPlugins.render-markdown-nvim ];

vim.luaConfigRC =
writeIf cfg.glow.enable ''
require('glow').setup({
glow_path = "${pkgs.glow}/bin/glow",
border = "shadow",
pager = false,
width = 120,
})
'' +
writeIf cfg.render.enable ''
require('render-markdown').setup({})
'';

vim.configRC =
writeIf cfg.glow.enable ''
autocmd FileType markdown noremap <leader>p <cmd>Glow<CR>
'' +
writeIf cfg.render.enable ''
autocmd FileType markdown noremap <leader>rt <cmd>RenderMarkdown toggle<CR>
'';
};
}
38 changes: 0 additions & 38 deletions modules/markdown/glow.nix

This file was deleted.

0 comments on commit 69a19b5

Please sign in to comment.