nix-community.nixvim/plugins/languages/typst/typst-vim.nix

54 lines
1.1 KiB
Nix
Raw Normal View History

2023-05-26 11:00:04 +02:00
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.plugins.typst-vim;
helpers = import ../../helpers.nix {inherit lib;};
in {
options.plugins.typst-vim =
helpers.extraOptionsOptions
// {
enable = mkEnableOption "typst.vim";
package = helpers.mkPackageOption "typst-vim" pkgs.vimPlugins.typst-vim;
keymaps = {
silent = mkOption {
type = types.bool;
description = "Whether typst-vim keymaps should be silent.";
default = false;
};
watch =
helpers.mkNullOrOption types.str
"Keymap to preview the document and recompile on change.";
};
};
config = mkIf cfg.enable {
extraPlugins = [cfg.package];
# Add the typst compiler to nixvim packages
extraPackages = with pkgs; [typst];
keymaps = with cfg.keymaps;
helpers.keymaps.mkKeymaps
{
mode = "n";
options.silent = silent;
}
(
optional
(watch != null)
{
# mode = "n";
key = watch;
action = ":TypstWatch<CR>";
}
);
2023-05-26 11:00:04 +02:00
};
}