nvf/modules/languages/markdown/config.nix

41 lines
910 B
Nix
Raw Normal View History

{
pkgs,
config,
lib,
...
}: let
inherit (lib) nvim mkIf mkMerge isList;
cfg = config.vim.languages.markdown;
2024-01-18 16:28:46 +00:00
servers = {
marksman = {
package = pkgs.marksman;
lspConfig = ''
lspconfig.marksman.setup{
capabilities = capabilities;
on_attach = default_on_attach;
cmd = ${
if isList cfg.lsp.package
then nvim.lua.expToLua cfg.lsp.package
else ''{"${cfg.lsp.package}/bin/marksman", "server"}''
},
}
'';
};
};
in {
config = mkIf cfg.enable (mkMerge [
2023-04-17 21:55:27 +00:00
(mkIf cfg.treesitter.enable {
vim.treesitter.enable = true;
vim.treesitter.grammars = [cfg.treesitter.mdPackage cfg.treesitter.mdInlinePackage];
2023-04-17 21:55:27 +00:00
})
2024-01-18 16:28:46 +00:00
(mkIf cfg.lsp.enable {
vim.lsp.lspconfig.enable = true;
vim.lsp.lspconfig.sources.markdown-lsp = servers.${cfg.lsp.server}.lspConfig;
})
]);
}