mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
43 lines
955 B
Nix
43 lines
955 B
Nix
|
{
|
||
|
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];
|
||
|
|
||
|
maps.normal = with cfg.keymaps;
|
||
|
helpers.mkModeMaps {inherit silent;} {
|
||
|
${watch} = ":TypstWatch<CR>";
|
||
|
};
|
||
|
};
|
||
|
}
|