Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/release-notes/rl-0.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,9 @@

- Add `vim.languages.zig.dap` support through pkgs.lldb dap adapter. Code
Inspiration from `vim.languages.clang.dap` implementation.

PartyWumpus:

[typst-concealer]: https://github.com/PartyWumpus/typst-concealer

- Add inline typst concealing support under `vim.languages.typst` using [typst-concealer].
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
61 changes: 60 additions & 1 deletion modules/plugins/languages/typst.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
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;
inherit (lib.nvim.binds) mkMappingOption mkKeymap;
inherit (lib.nvim.lua) expToLua toLuaObject;
inherit (lib.nvim.types) mkGrammarOption mkPluginSetupOption;
inherit (lib.nvim.dag) entryAnywhere;
Expand Down Expand Up @@ -167,6 +168,51 @@ 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?";
};
};
};
};
};
config = mkIf cfg.enable (mkMerge [
Expand All @@ -192,5 +238,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