AutoYADM commit: 2025-04-22 13:50:13
This commit is contained in:
parent
e3c89f1c37
commit
df0e3e4a89
1 changed files with 14 additions and 4 deletions
|
@ -1,11 +1,16 @@
|
||||||
#!/usr/bin/env fish
|
#!/usr/bin/env fish
|
||||||
|
|
||||||
|
function z --wraps zathura
|
||||||
|
zathura "$argv[1]" &>/dev/null &
|
||||||
|
end
|
||||||
|
|
||||||
set -l src (path resolve $argv[1])
|
set -l src (path resolve $argv[1])
|
||||||
# echo $src
|
# echo $src
|
||||||
# string replace
|
# string replace
|
||||||
set -l targ (string replace --filter '.typ' '.pdf' $src)
|
set -l targ (string replace --filter '.typ' '.pdf' $src)
|
||||||
if test -f "$targ" -a '' != ''
|
if test -f "$targ" -a '' != ''
|
||||||
zathura "$targ" &>/dev/null &
|
# zathura "$targ" &>/dev/null &
|
||||||
|
z "$targ"
|
||||||
else
|
else
|
||||||
# no such file in current dir, time to search!
|
# no such file in current dir, time to search!
|
||||||
# if we're in a git repo, search from root
|
# if we're in a git repo, search from root
|
||||||
|
@ -14,9 +19,14 @@ else
|
||||||
echo in git
|
echo in git
|
||||||
set -l root (git rev-parse --show-toplevel)
|
set -l root (git rev-parse --show-toplevel)
|
||||||
echo $root
|
echo $root
|
||||||
set -l base (path basename --no-extension)
|
set -l base (path basename --no-extension $src).pdf
|
||||||
set -l base $base.pdf
|
set -l candidate (fd --no-ignore-vcs -F -1 "$base" "$root")
|
||||||
echo $base
|
if test "$candidate" != ''
|
||||||
|
z "$candidate"
|
||||||
|
else
|
||||||
|
echo "$base" could not be found!
|
||||||
|
return 1
|
||||||
|
end
|
||||||
else
|
else
|
||||||
echo out git
|
echo out git
|
||||||
set -l root (pwd)
|
set -l root (pwd)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue