mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 19:11:15 +00:00
language/markdown: added markdown-previewer.nvim
This commit is contained in:
parent
d0f8e445ab
commit
7352558623
2 changed files with 73 additions and 1 deletions
|
@ -4,7 +4,8 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) nvim mkIf mkMerge mkBinding isList;
|
inherit (lib) nvim mkIf mkMerge mkBinding isList concatMapStringsSep;
|
||||||
|
inherit (nvim.vim) mkVimBool;
|
||||||
|
|
||||||
cfg = config.vim.languages.markdown;
|
cfg = config.vim.languages.markdown;
|
||||||
self = import ./markdown.nix {
|
self = import ./markdown.nix {
|
||||||
|
@ -49,6 +50,21 @@ in {
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(mkIf cfg.markdownPreview.enable {
|
||||||
|
vim.startPlugins = [pkgs.vimPlugins.markdown-preview-nvim];
|
||||||
|
|
||||||
|
vim.configRC.markdown-preview = nvim.dag.entryAnywhere ''
|
||||||
|
let g:mkdp_auto_start = ${mkVimBool cfg.markdownPreview.autoStart}
|
||||||
|
let g:mkdp_auto_close = ${mkVimBool cfg.markdownPreview.autoClose}
|
||||||
|
let g:mkdp_refresh_slow = ${mkVimBool cfg.markdownPreview.lazyRefresh}
|
||||||
|
let g:mkdp_filetypes = [${concatMapStringsSep ", " (x: "'" + x + "'") cfg.markdownPreview.filetypes}]
|
||||||
|
let g:mkdp_command_for_global = ${mkVimBool cfg.markdownPreview.alwaysAllowPreview}
|
||||||
|
let g:mkdp_open_to_the_world = ${mkVimBool cfg.markdownPreview.broadcastServer}
|
||||||
|
let g:mkdp_open_ip = '${cfg.markdownPreview.customIP}'
|
||||||
|
let g:mkdp_port = '${cfg.markdownPreview.customPort}'
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
|
||||||
(mkIf cfg.lsp.enable {
|
(mkIf cfg.lsp.enable {
|
||||||
vim.lsp.lspconfig.enable = true;
|
vim.lsp.lspconfig.enable = true;
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,62 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
markdownPreview = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Enable markdown preview in neovim with markdown-preview.nvim";
|
||||||
|
};
|
||||||
|
|
||||||
|
autoStart = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Automatically open the preview window after entering a Markdown buffer";
|
||||||
|
};
|
||||||
|
|
||||||
|
autoClose = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Automatically close the preview window after leaving a Markdown buffer";
|
||||||
|
};
|
||||||
|
|
||||||
|
lazyRefresh = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Only update preview when saving or leaving insert mode";
|
||||||
|
};
|
||||||
|
|
||||||
|
filetypes = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = ["markdown"];
|
||||||
|
description = "Allowed filetypes";
|
||||||
|
};
|
||||||
|
|
||||||
|
alwaysAllowPreview = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Allow preview on all filetypes";
|
||||||
|
};
|
||||||
|
|
||||||
|
broadcastServer = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = "Allow for outside and network wide connections";
|
||||||
|
};
|
||||||
|
|
||||||
|
customIP = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "";
|
||||||
|
description = "IP-address to use";
|
||||||
|
};
|
||||||
|
|
||||||
|
customPort = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "";
|
||||||
|
description = "Port to use";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
treesitter = {
|
treesitter = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
description = "Enable Markdown treesitter";
|
description = "Enable Markdown treesitter";
|
||||||
|
|
Loading…
Reference in a new issue