mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-10-03 07:23:30 +00:00
languages/typst: Add inline preview via typst-concealer (#588)
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Treewide Checks / Validate flake (push) Has been cancelled
Treewide Checks / Check formatting (push) Has been cancelled
Treewide Checks / Check source tree for typos (push) Has been cancelled
Treewide Checks / Validate documentation builds (push) Has been cancelled
Treewide Checks / Validate hyperlinks in documentation sources (push) Has been cancelled
Treewide Checks / Validate Editorconfig conformance (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Treewide Checks / Validate flake (push) Has been cancelled
Treewide Checks / Check formatting (push) Has been cancelled
Treewide Checks / Check source tree for typos (push) Has been cancelled
Treewide Checks / Validate documentation builds (push) Has been cancelled
Treewide Checks / Validate hyperlinks in documentation sources (push) Has been cancelled
Treewide Checks / Validate Editorconfig conformance (push) Has been cancelled
Build and deploy documentation / Check latest commit (push) Has been cancelled
Build and deploy documentation / publish (push) Has been cancelled
* add typst-concealer * Update modules/plugins/languages/typst.nix Co-authored-by: raf <raf@notashelf.dev> * add keybinds, resolve review etc * add changes back (it was easier than a rebase here) * add the newer conceal_in_normal option * run deno fmt * add "typ" to typos --------- Co-authored-by: raf <raf@notashelf.dev>
This commit is contained in:
parent
1bd9fc1164
commit
b7571df4d6
4 changed files with 87 additions and 1 deletions
|
@ -7,9 +7,10 @@
|
|||
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.meta) getExe;
|
||||
inherit (lib.nvim.binds) mkMappingOption mkKeymap;
|
||||
inherit (lib.nvim.lua) expToLua toLuaObject;
|
||||
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
@ -150,6 +151,57 @@ in {
|
|||
};
|
||||
};
|
||||
};
|
||||
typst-concealer = {
|
||||
enable = mkEnableOption ''
|
||||
[typst-concealer]: https://github.com/PartyWumpus/typst-concealer
|
||||
|
||||
Inline typst preview for Neovim via [typst-concealer]
|
||||
'';
|
||||
|
||||
mappings = {
|
||||
toggleConcealing = mkMappingOption "Enable typst-concealer in buffer" "<leader>TT";
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "typst-concealer" {
|
||||
do_diagnostics = mkOption {
|
||||
type = nullOr bool;
|
||||
default = !cfg.lsp.enable;
|
||||
description = "Should typst-concealer provide diagnostics on error?";
|
||||
};
|
||||
color = mkOption {
|
||||
type = nullOr str;
|
||||
default = null;
|
||||
example = "rgb(\"#f012be\")";
|
||||
description = "What color should typst-concealer render text/stroke with? (only applies when styling_type is 'colorscheme')";
|
||||
};
|
||||
enabled_by_default = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Should typst-concealer conceal newly opened buffers by default?";
|
||||
};
|
||||
styling_type = mkOption {
|
||||
type = nullOr (enum ["simple" "none" "colorscheme"]);
|
||||
default = null;
|
||||
description = "What kind of styling should typst-concealer apply to your typst?";
|
||||
};
|
||||
ppi = mkOption {
|
||||
type = nullOr int;
|
||||
default = null;
|
||||
description = "What PPI should typst render at. Plugin default is 300, typst's normal default is 144.";
|
||||
};
|
||||
typst_location = mkOption {
|
||||
type = str;
|
||||
default = getExe pkgs.typst;
|
||||
description = "Where should typst-concealer look for your typst binary?";
|
||||
example = ''lib.getExe pkgs.typst'';
|
||||
};
|
||||
conceal_in_normal = mkOption {
|
||||
type = nullOr bool;
|
||||
default = null;
|
||||
description = "Should typst-concealer still conceal when the normal mode cursor goes over a line.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable (mkMerge [
|
||||
|
@ -180,5 +232,18 @@ in {
|
|||
require("typst-preview").setup(${toLuaObject cfg.extensions.typst-preview-nvim.setupOpts})
|
||||
'';
|
||||
})
|
||||
|
||||
(mkIf cfg.extensions.typst-concealer.enable {
|
||||
vim.lazy.plugins.typst-concealer = {
|
||||
event = "BufRead *.typ";
|
||||
package = "typst-concealer";
|
||||
setupModule = "typst-concealer";
|
||||
setupOpts = cfg.extensions.typst-concealer.setupOpts;
|
||||
|
||||
keys = [
|
||||
(mkKeymap "n" cfg.extensions.typst-concealer.mappings.toggleConcealing "<cmd>lua require('typst-concealer').toggle_buf()<CR>" {desc = "Toggle typst-concealer in buffer";})
|
||||
];
|
||||
};
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue