浏览代码

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

April King 3 年之前
父节点
当前提交
4ae5bdebc3
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      plugins/osx/osx.plugin.zsh

+ 2 - 1
plugins/osx/osx.plugin.zsh

@@ -219,7 +219,8 @@ function quick-look() {
 }
 }
 
 
 function man-preview() {
 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
 compdef _man man-preview