mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-19 08:39:50 +01:00
utility/preview: cleanup and optionalString
This commit is contained in:
parent
319aaca06d
commit
2e07763149
7 changed files with 11 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./markdown-preview
|
./markdown-preview
|
||||||
./glow
|
./glow
|
||||||
|
|
|
@ -16,13 +16,13 @@ in {
|
||||||
vim.startPlugins = ["glow-nvim"];
|
vim.startPlugins = ["glow-nvim"];
|
||||||
|
|
||||||
vim.maps.normal = mkMerge [
|
vim.maps.normal = mkMerge [
|
||||||
(mkBinding cfg.glow.mappings.openPreview ":Glow<CR>" mappings.openPreview.description)
|
(mkBinding cfg.mappings.openPreview ":Glow<CR>" mappings.openPreview.description)
|
||||||
];
|
];
|
||||||
|
|
||||||
vim.luaConfigRC.glow = nvim.dag.entryAnywhere ''
|
vim.luaConfigRC.glow = nvim.dag.entryAnywhere ''
|
||||||
require('glow').setup({
|
require('glow').setup({
|
||||||
glow_path = "${pkgs.glow}/bin/glow"
|
glow_path = "${pkgs.glow}/bin/glow"
|
||||||
});
|
});
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./glow.nix
|
./glow.nix
|
||||||
./config.nix
|
./config.nix
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
in {
|
in {
|
||||||
options.vim.utility.preview = {
|
options.vim.utility.preview = {
|
||||||
glow = {
|
glow = {
|
||||||
enable = mkEnableOption "enable markdown preview in neovim with glow";
|
enable = mkEnableOption "markdown preview in neovim with glow";
|
||||||
mappings = {
|
mappings = {
|
||||||
openPreview = mkMappingOption "Open preview" "<leader>p";
|
openPreview = mkMappingOption "Open preview" "<leader>p";
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (lib) nvim mkIf mkMerge concatMapStringsSep;
|
inherit (lib) nvim mkIf concatMapStringsSep optionalString stringLength;
|
||||||
inherit (nvim.vim) mkVimBool;
|
inherit (nvim.vim) mkVimBool;
|
||||||
|
|
||||||
cfg = config.vim.utility.preview.markdownPreview;
|
cfg = config.vim.utility.preview.markdownPreview;
|
||||||
|
@ -19,8 +19,8 @@ in {
|
||||||
let g:mkdp_filetypes = [${concatMapStringsSep ", " (x: "'" + x + "'") cfg.filetypes}]
|
let g:mkdp_filetypes = [${concatMapStringsSep ", " (x: "'" + x + "'") cfg.filetypes}]
|
||||||
let g:mkdp_command_for_global = ${mkVimBool cfg.alwaysAllowPreview}
|
let g:mkdp_command_for_global = ${mkVimBool cfg.alwaysAllowPreview}
|
||||||
let g:mkdp_open_to_the_world = ${mkVimBool cfg.broadcastServer}
|
let g:mkdp_open_to_the_world = ${mkVimBool cfg.broadcastServer}
|
||||||
let g:mkdp_open_ip = '${cfg.customIP}'
|
${optionalString (stringLength cfg.customIP > 0) "let g:mkdp_open_ip = '${cfg.customIP}'"}
|
||||||
let g:mkdp_port = '${cfg.customPort}'
|
${optionalString (stringLength cfg.customPort > 0) "let g:mkdp_port = '${cfg.customPort}'"}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
_: {
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./markdown-preview.nix
|
./markdown-preview.nix
|
||||||
./config.nix
|
./config.nix
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
in {
|
in {
|
||||||
options.vim.utility.preview = {
|
options.vim.utility.preview = {
|
||||||
markdownPreview = {
|
markdownPreview = {
|
||||||
enable = mkEnableOption "enable Markdown preview in neovim with markdown-preview.nvim";
|
enable = mkEnableOption "Markdown preview in neovim with markdown-preview.nvim";
|
||||||
|
|
||||||
autoStart = mkOption {
|
autoStart = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
|
Loading…
Reference in a new issue