From df0e3e4a89cf405b41490503124a8f47625963df Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 22 Apr 2025 13:50:13 -0400 Subject: [PATCH] AutoYADM commit: 2025-04-22 13:50:13 --- .config/helix/scripts/typst-zathura.fish | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.config/helix/scripts/typst-zathura.fish b/.config/helix/scripts/typst-zathura.fish index ff15c081..bb84312c 100755 --- a/.config/helix/scripts/typst-zathura.fish +++ b/.config/helix/scripts/typst-zathura.fish @@ -1,11 +1,16 @@ #!/usr/bin/env fish +function z --wraps zathura + zathura "$argv[1]" &>/dev/null & +end + set -l src (path resolve $argv[1]) # echo $src # string replace set -l targ (string replace --filter '.typ' '.pdf' $src) if test -f "$targ" -a '' != '' - zathura "$targ" &>/dev/null & + # zathura "$targ" &>/dev/null & + z "$targ" else # no such file in current dir, time to search! # if we're in a git repo, search from root @@ -14,9 +19,14 @@ else echo in git set -l root (git rev-parse --show-toplevel) echo $root - set -l base (path basename --no-extension) - set -l base $base.pdf - echo $base + set -l base (path basename --no-extension $src).pdf + set -l candidate (fd --no-ignore-vcs -F -1 "$base" "$root") + if test "$candidate" != '' + z "$candidate" + else + echo "$base" could not be found! + return 1 + end else echo out git set -l root (pwd)