From 220086dbde49bfb556292938c49ffe6d310951a0 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Mon, 18 Nov 2024 07:52:07 +0100 Subject: [PATCH] mzte-nv: completely implement :TypstWatch command --- mzte-nv/conf/ftplugin/typst.fnl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/mzte-nv/conf/ftplugin/typst.fnl b/mzte-nv/conf/ftplugin/typst.fnl index a7a21fe..3527cfe 100644 --- a/mzte-nv/conf/ftplugin/typst.fnl +++ b/mzte-nv/conf/ftplugin/typst.fnl @@ -14,8 +14,14 @@ (.. "typst watch --root " root " " file " " outfile) (.. "typst watch " file " " - outfile))})] + outfile))}) + viewer-timer (vim.uv.new_timer)] (term:toggle) - (vim.uv.spawn :zathura {:args [outfile]} - (fn [code signal] (term:shutdown)))))] + (viewer-timer:start 2000 0 + (fn [] + (viewer-timer:stop) + (viewer-timer:close) + (vim.uv.spawn :zathura {:args [outfile]} + (fn [code signal] + (vim.schedule #(term:shutdown))))))))] (vim.api.nvim_create_user_command :TypstWatch cb {:nargs 0}))