4ae5bdebc36068a53fbc38a4e0d6d97e49f5b56c

Author
April King <april@pokeinthe.io>
Committer
GitHub <noreply@github.com>
Date

Message

fix(osx): only run Preview.app in `man-preview` if man page exists (#10222)

Diff

 1diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
 2index 7842e9f733fa8ddd479bdff58352b5db27ff2917..5455d7c5f78bf10c54a0872e2b40d8c2016fe902 100644
 3--- a/plugins/osx/osx.plugin.zsh
 4+++ b/plugins/osx/osx.plugin.zsh
 5@@ -219,7 +219,8 @@ function quick-look() {
 6 }
 7 
 8 function man-preview() {
 9-  man -t "$@" | open -f -a Preview
10+  # Don't let Preview.app steal focus if the man page doesn't exist
11+  man -w "$@" &>/dev/null && man -t "$@" | open -f -a Preview || man "$@"
12 }
13 compdef _man man-preview
14