18 lines
452 B
Fish
Executable file
18 lines
452 B
Fish
Executable file
#!/usr/bin/env fish
|
|
|
|
set -l src (path resolve $argv[1])
|
|
# echo $src
|
|
# string replace
|
|
set -l targ (string replace --filter '.typ' '.pdf' $src)
|
|
if test -f "$targ"
|
|
zathura "$targ" &>/dev/null &
|
|
else
|
|
# no such file in current dir, time to search!
|
|
# if we're in a git repo, search from root
|
|
# if we're not, search from cwd
|
|
if git rev-parse --is-inside-work-tree &>/dev/null
|
|
echo in git
|
|
else
|
|
echo out git
|
|
end
|
|
end
|