mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-12-04 20:32:32 +01:00
mzte-nv: implement TypstWatch command
This commit is contained in:
parent
95754797ec
commit
595680ef81
2 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,21 @@
|
|||
;; Use 2-space indentation for typst
|
||||
(set vim.o.shiftwidth 2)
|
||||
(set vim.o.tabstop 2)
|
||||
|
||||
(let [cb (fn [p]
|
||||
(let [Terminal (. (require :toggleterm.terminal) :Terminal)
|
||||
lspc-util (require :lspconfig.util)
|
||||
file (vim.api.nvim_buf_get_name 0)
|
||||
outfile (.. :/tmp/
|
||||
(string.gsub (vim.fs.basename file) "%.typ$" :.pdf))
|
||||
root ((lspc-util.root_pattern :.typstroot) file)
|
||||
term (Terminal:new {:direction :horizontal
|
||||
:cmd (if root
|
||||
(.. "typst watch --root " root
|
||||
" " file " " outfile)
|
||||
(.. "typst watch " file " "
|
||||
outfile))})]
|
||||
(term:toggle)
|
||||
(vim.uv.spawn :zathura {:args [outfile]}
|
||||
(fn [code signal] (term:shutdown)))))]
|
||||
(vim.api.nvim_create_user_command :TypstWatch cb {:nargs 0}))
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
(local tterm (require :toggleterm))
|
||||
|
||||
(tterm.setup {:size 64 :open_mapping :<C-t> :direction :vertical})
|
||||
(tterm.setup {:open_mapping :<C-t> :direction :vertical})
|
||||
|
|
Loading…
Reference in a new issue