neovim-flake/modules/markdown/glow/config.nix

34 lines
671 B
Nix
Raw Normal View History

{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.vim.markdown.glow;
in {
config = (mkIf cfg.enable) {
2023-03-01 12:00:26 +01:00
vim.startPlugins = [
"glow-nvim"
];
vim.globals = {
"glow_binary_path" = "${pkgs.glow}/bin";
};
2023-03-01 12:00:26 +01:00
vim.configRC.glow-nvim = nvim.dag.entryAnywhere ''
autocmd FileType markdown noremap <leader>pm :Glow<CR>
'';
vim.luaConfigRC.glow-nvim = nvim.dag.entryAnywhere ''
require('glow').setup({
-- use glow path from vim.globals
path = vim.g.glow_binary_path,
border = "${toString cfg.border}",
pager = ${boolToString cfg.pager},
width = 120,
})
'';
};
}