summaryrefslogtreecommitdiff
path: root/plugins/macos
diff options
context:
space:
mode:
authorBartek Pacia <barpac02@gmail.com>2024-04-09 11:19:14 +0100
committerGitHub <noreply@github.com>2024-04-09 12:19:14 +0200
commitf85f501bcf3dc771c64f4b2ec7609fc542d4d031 (patch)
treeab4e919f249a1e830aaaa907784f46c5a11b3f55 /plugins/macos
parentef402864830ba2e23720e3a6ee6f6b4f0e05d692 (diff)
downloadzsh-f85f501bcf3dc771c64f4b2ec7609fc542d4d031.tar.gz
zsh-f85f501bcf3dc771c64f4b2ec7609fc542d4d031.tar.bz2
zsh-f85f501bcf3dc771c64f4b2ec7609fc542d4d031.zip
feat(macos): `ofd` now opens any directory (#12337)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
Diffstat (limited to 'plugins/macos')
-rw-r--r--plugins/macos/README.md2
-rw-r--r--plugins/macos/macos.plugin.zsh11
2 files changed, 10 insertions, 3 deletions
diff --git a/plugins/macos/README.md b/plugins/macos/README.md
index 1cb9b395d..2c52ec8a7 100644
--- a/plugins/macos/README.md
+++ b/plugins/macos/README.md
@@ -17,7 +17,7 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
| `tab` | Open the current directory in a new tab |
| `split_tab` | Split the current terminal tab horizontally |
| `vsplit_tab` | Split the current terminal tab vertically |
-| `ofd` | Open the current directory in a Finder window |
+| `ofd` | Open passed directories (or $PWD by default) in Finder |
| `pfd` | Return the path of the frontmost Finder window |
| `pfs` | Return the current Finder selection |
| `cdf` | `cd` to the current Finder directory |
diff --git a/plugins/macos/macos.plugin.zsh b/plugins/macos/macos.plugin.zsh
index a4347005e..2702a1901 100644
--- a/plugins/macos/macos.plugin.zsh
+++ b/plugins/macos/macos.plugin.zsh
@@ -3,8 +3,15 @@
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
-# Open the current directory in a Finder window
-alias ofd='open_command $PWD'
+# Open in Finder the directories passed as arguments, or the current directory if
+# no directories are passed
+function ofd {
+ if (( ! $# )); then
+ open_command $PWD
+ else
+ open_command $@
+ fi
+}
# Show/hide hidden files in the Finder
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"