diff --git a/modules/shell/nu/custom_commands.nu b/modules/shell/nu/custom_commands.nu index e3581f3..5b66b1b 100644 --- a/modules/shell/nu/custom_commands.nu +++ b/modules/shell/nu/custom_commands.nu @@ -38,8 +38,13 @@ def glog [ def typed [ name: string ] { - touch $"($name).typ" - typst compile $"($name).typ" + const DEFAULT_TYPST_FILE = "#import \"@local/typst-configs:0.1.0\": generic, sf;\n#show: generic.with();" + if not ($"($name).typ" | path exists) and not ($"($name).pdf" | path exists) { + $DEFAULT_TYPST_FILE | save $"($name).typ" + typst compile $"($name).typ" + } else if ($"($name).pdf" | path exists) { + typst compile $"($name).typ" + } mprocs --names Editor,Viewer,Notify $"hx '($name).typ'" $"while true; do mupdf-x11 '($name).pdf' && break; done" $"while inotifywait -e modify '($name).pdf' ; do pkill -HUP mupdf; done" }