nvim: typst auto root finding

This commit is contained in:
dogeystamp 2023-08-27 10:59:48 -04:00
parent 692bbb8e56
commit fc2f333223
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38

View File

@ -17,13 +17,18 @@ function ScreenshotFig()
endf
nnoremap <silent><leader>fs :call ScreenshotFig()<cr>
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 \<c-w>h"
endfunc
nnoremap <silent><leader>fc :call TypstWatch()<cr>
nnoremap <silent><leader>fr :silent exec "!zathura --fork " . expand("%:p:r") . ".pdf &"<cr>