mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-22 08:53:28 +02:00
plugins/typst-vim: init plugin + test
This commit is contained in:
parent
2f4a546ba6
commit
3f08cff1d0
3 changed files with 60 additions and 0 deletions
42
plugins/languages/typst/typst-vim.nix
Normal file
42
plugins/languages/typst/typst-vim.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{
|
||||
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>";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue