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 endf
nnoremap <silent><leader>fs :call ScreenshotFig()<cr> nnoremap <silent><leader>fs :call ScreenshotFig()<cr>
function GitRoot()
return fnamemodify(finddir('.git', ";"), ":h")
endfunc
" compile typst doc on write " compile typst doc on write
function TypstWatch() function TypstWatch()
vsp vsp
vertical resize 20 vertical resize 20
exec 'terminal ' .. 'typst watch ' .. expand("%:") exec 'terminal ' .. 'typst watch --root ' .. GitRoot() .. " " .. expand("%:")
exec "norm \<c-w>h" exec "norm \<c-w>h"
endfunc endfunc
nnoremap <silent><leader>fc :call TypstWatch()<cr> nnoremap <silent><leader>fc :call TypstWatch()<cr>
nnoremap <silent><leader>fr :silent exec "!zathura --fork " . expand("%:p:r") . ".pdf &"<cr> nnoremap <silent><leader>fr :silent exec "!zathura --fork " . expand("%:p:r") . ".pdf &"<cr>