3 Commits 3e2a5742cd ... f85f501bcf

Author SHA1 Message Date
  Bartek Pacia f85f501bcf feat(macos): `ofd` now opens any directory (#12337) 3 weeks ago
  Taekin Kim ef40286483 docs: fix typo (#12339) 3 weeks ago
  MoAlkhateeb a8f7f9f707 fix(history)!: fix arg passing to `fc` for `history` command (#12338) 3 weeks ago
4 changed files with 13 additions and 6 deletions
  1. 1 1
      README.md
  2. 2 2
      lib/history.zsh
  3. 1 1
      plugins/macos/README.md
  4. 9 2
      plugins/macos/macos.plugin.zsh

+ 1 - 1
README.md

@@ -366,7 +366,7 @@ zstyle ':omz:lib:directories' aliases no
 
 Async prompt functions are an experimental feature (included on April 3, 2024) that allows Oh My Zsh to render prompt information
 asyncronously. This can improve prompt rendering performance, but it might not work well with some setups. We hope that's not an
-issue, but if you're seeing problems with this new feature, you can turn it of by setting the following in your .zshrc file,
+issue, but if you're seeing problems with this new feature, you can turn it off by setting the following in your .zshrc file,
 before Oh My Zsh is sourced:
 
 ```sh

+ 2 - 2
lib/history.zsh

@@ -12,8 +12,8 @@ function omz_history {
     # if -l provided, run as if calling `fc' directly
     builtin fc "$@"
   else
-    # unless a number is provided, show all history events (starting from 1)
-    [[ ${@[-1]-} = *[0-9]* ]] && builtin fc -l "$@" || builtin fc -l "$@" 1
+    # otherwise, run `fc -l` with a custom format
+    builtin fc -l "$@"
   fi
 }
 

+ 1 - 1
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                     |

+ 9 - 2
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"