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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

84 lines
1.9 KiB
Nix
Raw Normal View History

2023-05-26 11:00:04 +02:00
{
lib,
helpers,
config,
pkgs,
2023-05-26 11:00:04 +02:00
...
}:
with lib;
helpers.vim-plugin.mkVimPlugin config {
name = "typst-vim";
originalName = "typst.vim";
defaultPackage = pkgs.vimPlugins.typst-vim;
globalPrefix = "typst_";
2023-11-17 19:44:54 +01:00
# Add the typst compiler to nixvim packages
extraPackages = [ pkgs.typst ];
2023-11-17 19:44:54 +01:00
maintainers = [ maintainers.GaetanLepage ];
2023-05-26 11:00:04 +02:00
# TODO introduced 2024-02-20: remove 2024-04-20
deprecateExtraConfig = true;
optionsRenamedToSettings = [
"cmd"
"pdfViewer"
"concealMath"
"autoCloseToc"
];
2023-11-17 19:44:54 +01:00
extraOptions = {
keymaps = {
silent = mkOption {
type = types.bool;
description = "Whether typst-vim keymaps should be silent.";
default = false;
2023-05-26 11:00:04 +02:00
};
2024-05-05 19:39:35 +02:00
watch = helpers.mkNullOrOption types.str "Keymap to preview the document and recompile on change.";
};
2024-05-05 19:39:35 +02:00
};
2023-11-17 19:44:54 +01:00
extraConfig = cfg: {
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
};
settingsOptions = {
cmd = helpers.defaultNullOpts.mkStr "typst" ''
Specifies the location of the Typst executable.
2023-11-17 19:44:54 +01:00
'';
pdf_viewer = helpers.mkNullOrOption types.str ''
Specifies pdf viewer that `typst watch --open` will use.
'';
2023-05-26 11:00:04 +02:00
conceal_math = helpers.defaultNullOpts.mkBool false ''
Enable concealment for math symbols in math mode (i.e. replaces symbols with their actual
unicode character).
Warning: this can affect performance
'';
2023-05-26 11:00:04 +02:00
auto_close_toc = helpers.defaultNullOpts.mkBool false ''
Specifies whether TOC will be automatically closed after using it.
'';
};
2023-11-17 19:44:54 +01:00
settingsExample = {
cmd = "typst";
conceal_math = true;
auto_close_toc = true;
};
}