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
|
@ -43,6 +43,7 @@
|
||||||
./languages/treesitter/treesitter-playground.nix
|
./languages/treesitter/treesitter-playground.nix
|
||||||
./languages/treesitter/treesitter-rainbow.nix
|
./languages/treesitter/treesitter-rainbow.nix
|
||||||
./languages/treesitter/treesitter-refactor.nix
|
./languages/treesitter/treesitter-refactor.nix
|
||||||
|
./languages/typst/typst-vim.nix
|
||||||
./languages/vimtex.nix
|
./languages/vimtex.nix
|
||||||
./languages/zig.nix
|
./languages/zig.nix
|
||||||
|
|
||||||
|
|
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>";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
17
tests/test-sources/plugins/languages/typst/typst-vim.nix
Normal file
17
tests/test-sources/plugins/languages/typst/typst-vim.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
empty = {
|
||||||
|
plugins.typst-vim.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
example = {
|
||||||
|
plugins.typst-vim = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
keymaps = {
|
||||||
|
silent = true;
|
||||||
|
|
||||||
|
watch = "<leader>w";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue