diff --git a/configuration.nix b/configuration.nix index 421fa8c..916f2bb 100644 --- a/configuration.nix +++ b/configuration.nix @@ -58,7 +58,12 @@ inputs: let enableTreesitter = true; enableExtraDiagnostics = true; + nim.enable = false; + elixir.enable = false; + nix.enable = true; + markdown.enable = true; + html.enable = isMaximal; css.enable = isMaximal; sql.enable = isMaximal; @@ -69,10 +74,7 @@ inputs: let zig.enable = isMaximal; python.enable = isMaximal; dart.enable = isMaximal; - elixir.enable = isMaximal; bash.enable = isMaximal; - terraform.enable = isMaximal; - nim.enable = false; tailwind.enable = isMaximal; typst.enable = isMaximal; clang = { diff --git a/modules/plugins/languages/default.nix b/modules/plugins/languages/default.nix index 8597b72..3a33ad0 100644 --- a/modules/plugins/languages/default.nix +++ b/modules/plugins/languages/default.nix @@ -5,7 +5,6 @@ in { ./bash ./dart ./elixir - ./markdown ./tidal ./clang.nix @@ -14,6 +13,7 @@ in { ./html.nix ./java.nix ./lua.nix + ./markdown.nix ./nim.nix ./nix.nix ./php.nix diff --git a/modules/plugins/languages/markdown/markdown.nix b/modules/plugins/languages/markdown.nix similarity index 62% rename from modules/plugins/languages/markdown/markdown.nix rename to modules/plugins/languages/markdown.nix index a58be2a..7fcc364 100644 --- a/modules/plugins/languages/markdown/markdown.nix +++ b/modules/plugins/languages/markdown.nix @@ -4,7 +4,7 @@ lib, ... }: let - inherit (builtins) attrNames; + inherit (builtins) attrNames concatLists; inherit (lib.options) mkEnableOption mkOption; inherit (lib.lists) isList; inherit (lib.types) bool enum either package listOf str; @@ -29,6 +29,22 @@ ''; }; }; + + defaultFormat = "denofmt"; + formats = { + denofmt = { + package = pkgs.deno; + nullConfig = '' + table.insert( + ls_sources, + null_ls.builtins.formatting.deno_fmt.with({ + filetypes = ${concatLists cfg.format.extraFiletypes ["markdown"]}, + command = "${cfg.format.package}/bin/deno", + }) + ) + ''; + }; + }; in { options.vim.languages.markdown = { enable = mkEnableOption "Markdown markup language support"; @@ -59,5 +75,27 @@ in { default = servers.${cfg.lsp.server}.package; }; }; + + format = { + enable = mkEnableOption "Markdown formatting" // {default = config.vim.languages.enableFormat;}; + + type = mkOption { + description = "Markdown formatter to use"; + type = enum (attrNames formats); + default = defaultFormat; + }; + + package = mkOption { + description = "Markdown formatter package"; + type = package; + default = formats.${cfg.format.type}.package; + }; + + extraFiletypes = mkOption { + description = "Extra filetypes to format with the Markdown formatter"; + type = listOf str; + default = []; + }; + }; }; } diff --git a/modules/plugins/languages/markdown/config.nix b/modules/plugins/languages/markdown/config.nix deleted file mode 100644 index ccc8836..0000000 --- a/modules/plugins/languages/markdown/config.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - pkgs, - config, - lib, - ... -}: let - inherit (lib.nvim.lua) expToLua; - inherit (lib.modules) mkIf mkMerge; - inherit (lib.lists) isList; - - cfg = config.vim.languages.markdown; - servers = { - marksman = { - package = pkgs.marksman; - lspConfig = '' - lspconfig.marksman.setup{ - capabilities = capabilities; - on_attach = default_on_attach; - cmd = ${ - if isList cfg.lsp.package - then expToLua cfg.lsp.package - else ''{"${cfg.lsp.package}/bin/marksman", "server"}'' - }, - } - ''; - }; - }; -in { - config = mkIf cfg.enable (mkMerge [ - (mkIf cfg.treesitter.enable { - vim.treesitter.enable = true; - vim.treesitter.grammars = [cfg.treesitter.mdPackage cfg.treesitter.mdInlinePackage]; - }) - - (mkIf cfg.lsp.enable { - vim.lsp.lspconfig.enable = true; - vim.lsp.lspconfig.sources.markdown-lsp = servers.${cfg.lsp.server}.lspConfig; - }) - ]); -} diff --git a/modules/plugins/languages/markdown/default.nix b/modules/plugins/languages/markdown/default.nix deleted file mode 100644 index 3834589..0000000 --- a/modules/plugins/languages/markdown/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{...}: { - imports = [ - ./config.nix - ./markdown.nix - ]; -}