diff --git a/src/.config/nvim/ftplugin/typst.vim b/src/.config/nvim/ftplugin/typst.vim index 6b81002..e65673f 100644 --- a/src/.config/nvim/ftplugin/typst.vim +++ b/src/.config/nvim/ftplugin/typst.vim @@ -17,13 +17,18 @@ function ScreenshotFig() endf nnoremap fs :call ScreenshotFig() +function GitRoot() + return fnamemodify(finddir('.git', ";"), ":h") +endfunc + " compile typst doc on write function TypstWatch() vsp vertical resize 20 - exec 'terminal ' .. 'typst watch ' .. expand("%:") + exec 'terminal ' .. 'typst watch --root ' .. GitRoot() .. " " .. expand("%:") exec "norm \h" endfunc + nnoremap fc :call TypstWatch() nnoremap fr :silent exec "!zathura --fork " . expand("%:p:r") . ".pdf &"