From 4ae5bdebc36068a53fbc38a4e0d6d97e49f5b56c Mon Sep 17 00:00:00 2001 From: April King Date: Tue, 28 Sep 2021 04:40:31 -0500 Subject: [PATCH] fix(osx): only run Preview.app in `man-preview` if man page exists (#10222) --- plugins/osx/osx.plugin.zsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh index 7842e9f73..5455d7c5f 100644 --- a/plugins/osx/osx.plugin.zsh +++ b/plugins/osx/osx.plugin.zsh @@ -219,7 +219,8 @@ function quick-look() { } function man-preview() { - man -t "$@" | open -f -a Preview + # Don't let Preview.app steal focus if the man page doesn't exist + man -w "$@" &>/dev/null && man -t "$@" | open -f -a Preview || man "$@" } compdef _man man-preview