Skip to content

Commit

Permalink
feat(macos): ofd now opens any directory (ohmyzsh#12337)
Browse files Browse the repository at this point in the history
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
  • Loading branch information
2 people authored and lukaselmer committed Apr 16, 2024
1 parent 85247d8 commit 6079800
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion plugins/macos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand Down
11 changes: 9 additions & 2 deletions plugins/macos/macos.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 6079800

Please sign in to comment.