utility/preview: cleanup and optionalString

This commit is contained in:
Donnerinoern 2024-02-13 15:45:47 +01:00
commit 2e07763149
7 changed files with 11 additions and 11 deletions

View file

@ -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}'"}
'';
};
}