add typst-concealer

This commit is contained in:
PartyWumpus 2025-01-27 02:53:46 +00:00
commit d9448d8ed3
3 changed files with 72 additions and 1 deletions

17
flake.lock generated
View file

@ -2633,6 +2633,22 @@
"type": "github"
}
},
"plugin-typst-concealer": {
"flake": false,
"locked": {
"lastModified": 1737944956,
"narHash": "sha256-YCkxM1xqY3gTrKVzRFI4fedOzhEeIq/dnYya/MST6Qo=",
"owner": "PartyWumpus",
"repo": "typst-concealer",
"rev": "e3d5bc44dc4ea9d68f3cee271eee1a75ff7d59e9",
"type": "github"
},
"original": {
"owner": "PartyWumpus",
"repo": "typst-concealer",
"type": "github"
}
},
"plugin-typst-preview-nvim": {
"flake": false,
"locked": {
@ -2926,6 +2942,7 @@
"plugin-tokyonight": "plugin-tokyonight",
"plugin-trouble": "plugin-trouble",
"plugin-ts-error-translator": "plugin-ts-error-translator",
"plugin-typst-concealer": "plugin-typst-concealer",
"plugin-typst-preview-nvim": "plugin-typst-preview-nvim",
"plugin-vim-dirtytalk": "plugin-vim-dirtytalk",
"plugin-vim-fugitive": "plugin-vim-fugitive",

View file

@ -210,6 +210,11 @@
flake = false;
};
plugin-typst-concealer = {
url = "github:PartyWumpus/typst-concealer";
flake = false;
};
plugin-nvim-metals = {
url = "github:scalameta/nvim-metals";
flake = false;

View file

@ -7,7 +7,7 @@
inherit (lib.options) mkEnableOption mkOption;
inherit (lib.modules) mkIf mkMerge;
inherit (lib.lists) isList;
inherit (lib.types) nullOr enum either attrsOf listOf package str;
inherit (lib.types) nullOr enum either attrsOf listOf package str bool int;
inherit (lib.attrsets) attrNames;
inherit (lib.generators) mkLuaInline;
inherit (lib.meta) getExe;
@ -167,6 +167,48 @@ in {
};
};
};
typst-concealer = {
enable =
mkEnableOption ''
[typst-concealer]: https://github.com/PartyWumpus/typst-concealer
Inline typst preview for Neovim via [typst-concealer]
''
// {default = false;};
setupOpts = mkPluginSetupOption "typst-concealer" {
do_diagnostics = mkOption {
type = nullOr bool;
description = ''Should typst-concealer provide diagnostics on error?'';
default = !cfg.lsp.enable;
};
color = mkOption {
type = nullOr str;
description = ''What color should typst-concealer render text/stroke with? (only applies when styling_type is "colorscheme")'';
default = null;
};
enabled_by_default = mkOption {
type = nullOr bool;
description = ''Should typst-concealer conceal newly opened buffers by default?'';
default = null;
};
styling_type = mkOption {
type = nullOr (enum ["simple" "none" "colorscheme"]);
description = ''What kind of styling should typst-concealer apply to your typst?'';
default = null;
};
ppi = mkOption {
type = nullOr int;
description = ''What PPI should typst render at. Plugin default is 300, typst's normal default is 144.'';
default = null;
};
typst_location = mkOption {
type = str;
default = getExe pkgs.typst;
description = ''Where should typst-concealer look for your typst binary?'';
};
};
};
};
};
config = mkIf cfg.enable (mkMerge [
@ -192,5 +234,12 @@ in {
require("typst-preview").setup(${toLuaObject cfg.extensions.typst-preview-nvim.setupOpts})
'';
})
(mkIf cfg.extensions.typst-concealer.enable {
vim.startPlugins = ["typst-concealer"];
vim.pluginRC.typst-concealer = entryAnywhere ''
require("typst-concealer").setup(${toLuaObject cfg.extensions.typst-concealer.setupOpts})
'';
})
]);
}