From 2e0776314965fa39cdc96366d680da72bef19150 Mon Sep 17 00:00:00 2001 From: Donnerinoern <72634505+Donnerinoern@users.noreply.github.com> Date: Tue, 13 Feb 2024 15:45:47 +0100 Subject: [PATCH] utility/preview: cleanup and optionalString --- modules/utility/preview/default.nix | 2 +- modules/utility/preview/glow/config.nix | 6 +++--- modules/utility/preview/glow/default.nix | 2 +- modules/utility/preview/glow/glow.nix | 2 +- modules/utility/preview/markdown-preview/config.nix | 6 +++--- modules/utility/preview/markdown-preview/default.nix | 2 +- .../utility/preview/markdown-preview/markdown-preview.nix | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/utility/preview/default.nix b/modules/utility/preview/default.nix index 84a9d58..0228395 100644 --- a/modules/utility/preview/default.nix +++ b/modules/utility/preview/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./markdown-preview ./glow diff --git a/modules/utility/preview/glow/config.nix b/modules/utility/preview/glow/config.nix index d9b4170..5b9e14f 100644 --- a/modules/utility/preview/glow/config.nix +++ b/modules/utility/preview/glow/config.nix @@ -16,13 +16,13 @@ in { vim.startPlugins = ["glow-nvim"]; vim.maps.normal = mkMerge [ - (mkBinding cfg.glow.mappings.openPreview ":Glow" mappings.openPreview.description) + (mkBinding cfg.mappings.openPreview ":Glow" mappings.openPreview.description) ]; vim.luaConfigRC.glow = nvim.dag.entryAnywhere '' require('glow').setup({ - glow_path = "${pkgs.glow}/bin/glow" - }); + glow_path = "${pkgs.glow}/bin/glow" + }); ''; }; } diff --git a/modules/utility/preview/glow/default.nix b/modules/utility/preview/glow/default.nix index 9b128a3..6acc82f 100644 --- a/modules/utility/preview/glow/default.nix +++ b/modules/utility/preview/glow/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./glow.nix ./config.nix diff --git a/modules/utility/preview/glow/glow.nix b/modules/utility/preview/glow/glow.nix index a0ae0ed..e75547c 100644 --- a/modules/utility/preview/glow/glow.nix +++ b/modules/utility/preview/glow/glow.nix @@ -3,7 +3,7 @@ in { options.vim.utility.preview = { glow = { - enable = mkEnableOption "enable markdown preview in neovim with glow"; + enable = mkEnableOption "markdown preview in neovim with glow"; mappings = { openPreview = mkMappingOption "Open preview" "p"; }; diff --git a/modules/utility/preview/markdown-preview/config.nix b/modules/utility/preview/markdown-preview/config.nix index 9fb1697..b60f612 100644 --- a/modules/utility/preview/markdown-preview/config.nix +++ b/modules/utility/preview/markdown-preview/config.nix @@ -4,7 +4,7 @@ lib, ... }: let - inherit (lib) nvim mkIf mkMerge concatMapStringsSep; + inherit (lib) nvim mkIf concatMapStringsSep optionalString stringLength; inherit (nvim.vim) mkVimBool; cfg = config.vim.utility.preview.markdownPreview; @@ -19,8 +19,8 @@ in { let g:mkdp_filetypes = [${concatMapStringsSep ", " (x: "'" + x + "'") cfg.filetypes}] let g:mkdp_command_for_global = ${mkVimBool cfg.alwaysAllowPreview} let g:mkdp_open_to_the_world = ${mkVimBool cfg.broadcastServer} - let g:mkdp_open_ip = '${cfg.customIP}' - let g:mkdp_port = '${cfg.customPort}' + ${optionalString (stringLength cfg.customIP > 0) "let g:mkdp_open_ip = '${cfg.customIP}'"} + ${optionalString (stringLength cfg.customPort > 0) "let g:mkdp_port = '${cfg.customPort}'"} ''; }; } diff --git a/modules/utility/preview/markdown-preview/default.nix b/modules/utility/preview/markdown-preview/default.nix index 89904c1..dd33aba 100644 --- a/modules/utility/preview/markdown-preview/default.nix +++ b/modules/utility/preview/markdown-preview/default.nix @@ -1,4 +1,4 @@ -_: { +{ imports = [ ./markdown-preview.nix ./config.nix diff --git a/modules/utility/preview/markdown-preview/markdown-preview.nix b/modules/utility/preview/markdown-preview/markdown-preview.nix index 4db6c54..c3244b0 100644 --- a/modules/utility/preview/markdown-preview/markdown-preview.nix +++ b/modules/utility/preview/markdown-preview/markdown-preview.nix @@ -3,7 +3,7 @@ in { options.vim.utility.preview = { markdownPreview = { - enable = mkEnableOption "enable Markdown preview in neovim with markdown-preview.nvim"; + enable = mkEnableOption "Markdown preview in neovim with markdown-preview.nvim"; autoStart = mkOption { type = types.bool;