summaryrefslogtreecommitdiff
path: root/plugins/macos
diff options
context:
space:
mode:
authorRichard Mitchell <rwmitchell@gmail.com>2023-02-26 16:40:44 -0500
committerGitHub <noreply@github.com>2023-02-26 22:40:44 +0100
commit16050ab80e63f8e53c07777b4c2ae16ad085e5ad (patch)
tree6fc4a9882e28c3c682104706d697ddb0bc5e495a /plugins/macos
parent0ca8907f0e6185545c5e38f77ae2f09ca2a44e77 (diff)
downloadzsh-16050ab80e63f8e53c07777b4c2ae16ad085e5ad.tar.gz
zsh-16050ab80e63f8e53c07777b4c2ae16ad085e5ad.tar.bz2
zsh-16050ab80e63f8e53c07777b4c2ae16ad085e5ad.zip
feat(macos): allow multiple man pages in `man-preview` (#11365)
Diffstat (limited to 'plugins/macos')
-rw-r--r--plugins/macos/README.md2
-rw-r--r--plugins/macos/macos.plugin.zsh7
2 files changed, 5 insertions, 4 deletions
diff --git a/plugins/macos/README.md b/plugins/macos/README.md
index 1bc4244a4..1cb9b395d 100644
--- a/plugins/macos/README.md
+++ b/plugins/macos/README.md
@@ -25,7 +25,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
| `pxd` | Return the current Xcode project directory |
| `cdx` | `cd` to the current Xcode project directory |
| `quick-look` | Quick-Look a specified file |
-| `man-preview` | Open a specified man page in Preview app |
+| `man-preview` | Open man pages in Preview app |
| `showfiles` | Show hidden files in Finder |
| `hidefiles` | Hide the hidden files in Finder |
| `itunes` | _DEPRECATED_. Use `music` from macOS Catalina on |
diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh
index e4d759dcf..e27d412c8 100644
--- a/plugins/macos/macos.plugin.zsh
+++ b/plugins/macos/macos.plugin.zsh
@@ -224,9 +224,10 @@ function quick-look() {
}
function man-preview() {
- local location
- # Don't let Preview.app steal focus if the man page doesn't exist
- location=$(man -w "$@") && mandoc -Tpdf $location | open -f -a Preview
+ local page
+ for page in "${(@f)"$(man -w $@)"}"; do
+ command mandoc -Tpdf $page | open -f -a Preview
+ done
}
compdef _man man-preview