From da19031199995d8443f59d11a60fb6d819f4bfb2 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 27 Sep 2024 14:49:02 -0700 Subject: [PATCH] feat: add typst preview --- config/autocmds.nix | 14 ++++++++++++++ config/default.nix | 1 + config/plugins/default.nix | 1 + config/plugins/typst.nix | 10 ++++++++++ flake.lock | 19 ++++++++++++++++++- flake.nix | 4 ++++ 6 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 config/plugins/typst.nix diff --git a/config/autocmds.nix b/config/autocmds.nix index 153b957..fb6dcaf 100644 --- a/config/autocmds.nix +++ b/config/autocmds.nix @@ -6,5 +6,19 @@ "TermOpen" ]; } + # { + # command = { + # __raw = '' + # require('typst-preview').update() + # ''; + # }; + # event = [ + # "BufEnter" + # "BufWinEnter" + # ]; + # pattern = [ + # "*.typ" + # ]; + # } ]; } diff --git a/config/default.nix b/config/default.nix index ee3c657..8fa432b 100644 --- a/config/default.nix +++ b/config/default.nix @@ -17,6 +17,7 @@ standalonePlugins = [ "nvim-treesitter" "vimplugin-treesitter-grammar-nix" + "vimplugin-typst-preview.nvim" ]; }; byteCompileLua = { diff --git a/config/plugins/default.nix b/config/plugins/default.nix index 19d51a9..d0a6e29 100644 --- a/config/plugins/default.nix +++ b/config/plugins/default.nix @@ -9,5 +9,6 @@ ./misc.nix ./navigation.nix ./treesitter.nix + ./typst.nix ]; } diff --git a/config/plugins/typst.nix b/config/plugins/typst.nix new file mode 100644 index 0000000..03f636a --- /dev/null +++ b/config/plugins/typst.nix @@ -0,0 +1,10 @@ +{ inputs, pkgs, ... }: +{ + plugins.typst-vim.enable = true; + extraPlugins = [ + (pkgs.vimUtils.buildVimPlugin { + name = "typst-preview.nvim"; + src = inputs.typst-preview; + }) + ]; +} diff --git a/flake.lock b/flake.lock index a0e2de4..539caf3 100644 --- a/flake.lock +++ b/flake.lock @@ -337,7 +337,8 @@ "nixpkgs": "nixpkgs", "nixvim": "nixvim", "render-markdown": "render-markdown", - "satellite": "satellite" + "satellite": "satellite", + "typst-preview": "typst-preview" } }, "satellite": { @@ -391,6 +392,22 @@ "repo": "treefmt-nix", "type": "github" } + }, + "typst-preview": { + "flake": false, + "locked": { + "lastModified": 1724595641, + "narHash": "sha256-kJ6IfLSBmJMgEFuCy6fGtqSRBXjt2Aoxu2NW9iyzRLU=", + "owner": "chomosuke", + "repo": "typst-preview.nvim", + "rev": "7ae2b82cf334819494505b772745beb28705b12b", + "type": "github" + }, + "original": { + "owner": "chomosuke", + "repo": "typst-preview.nvim", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index a41b421..93ad578 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,10 @@ url = "github:Eandrju/cellular-automaton.nvim"; flake = false; }; + typst-preview = { + url = "github:chomosuke/typst-preview.nvim"; + flake = false; + }; }; outputs =