From f85f501bcf3dc771c64f4b2ec7609fc542d4d031 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Tue, 9 Apr 2024 11:19:14 +0100 Subject: feat(macos): `ofd` now opens any directory (#12337) Co-authored-by: Carlo Sala --- plugins/macos/macos.plugin.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'plugins/macos/macos.plugin.zsh') 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" -- cgit v1.2.3-70-g09d2