make typst live editing and preview a thing

This commit is contained in:
Schrottkatze 2024-02-28 17:06:04 +01:00
parent 65039f4f17
commit 4f01412843
Signed by: schrottkatze
SSH key fingerprint: SHA256:hXb3t1vINBFCiDCmhRABHX5ocdbLiKyCdKI4HK2Rbbc
3 changed files with 104 additions and 30 deletions

View file

@ -803,18 +803,15 @@ def glog [
] {
git log --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD -n $amount
| lines
| split column "»¦«" commit subject name email date
| split column "»¦«u commit subject name email date"
}
def ed [
file: path
...cmdargs: string
def typed [
name: string
] {
let ext = $file | path parse | get extension;
match $ext {
"typ" => {|| zellij run --direction down -- typst watch $file ($cmdargs | prepend '--open' | str join ' ') }
};
hx $file
touch $"($name).typ"
typst compile $"($name).typ"
mprocs --names Editor,Viewer,Notify $"hx '($name).typ'" $"mupdf-x11 '($name).pdf'" $"while inotifywait -e modify '($name).pdf' ; do pkill -HUP mupdf; done"
}
alias gnix = cd ~/nix-configs;