diff --git a/.config/helix/scripts/typst-zathura.fish b/.config/helix/scripts/typst-zathura.fish index 2b7cfcea..d57881e4 100755 --- a/.config/helix/scripts/typst-zathura.fish +++ b/.config/helix/scripts/typst-zathura.fish @@ -21,6 +21,7 @@ set -l src (path resolve $argv[1]) # echo $src # string replace set -l targ (string replace --filter '.typ' '.pdf' $src) +set -l base (path basename --no-extension $src).pdf if test -f "$targ" -a '' != '' # zathura "$targ" &>/dev/null & z "$targ" @@ -30,18 +31,17 @@ else # if we're not, search from cwd if git rev-parse --is-inside-work-tree &>/dev/null # echo in git - set -l root (git rev-parse --show-toplevel) + set root (git rev-parse --show-toplevel) # echo $root - set -l base (path basename --no-extension $src).pdf - if not find_pdf "$root" "$base" - if set -q _flag_q - return 1 - else - echo "$base couldn't be found!" - end - end else echo out git - set -l root (pwd) + set root (pwd) + end + if not find_pdf "$root" "$base" + if set -q _flag_q + return 1 + else + echo "$base couldn't be found!" + end end end