Chooses the "best" PDF viewer available.
command tree -C "$@" | less
}
-# Automatically disown.
-xpdf() {
- command xpdf "$@" &
- disown %command
-}
+# Choose the "best" PDF viewer available: zathura, then xpdf. Also setup
+# completion for `pdf`.
+if (( $+commands[zathura] )); then
+ pdf() {
+ command zathura "$@" 2>/dev/null &
+ disown %command
+ }
+ # No completion for zathura yet.
+ compdef _xpdf pdf
+elif (( $+commands[xpdf] )); then
+ pdf() {
+ command xpdf "$@" 2>/dev/null &
+ disown %command
+ }
+ compdef _xpdf pdf
+fi
# GHCI doesn't use readline, force it if rlwrap is available.
(( $+commands[rlwrap] )) && ghci() {