605d76616aa47b2e5abe25eb26c4c9c1554f93d5

Author
MoAlkhateeb <110918029+MoAlkhateeb@users.noreply.github.com>
Committer
GitHub <noreply@github.com>
Date

Message

fix(history): revert to old behavior when no args passed (#12341)

* Fixed a bug in *omz_history* where it would automatically create a file when run with the -p flag

* Reverted old history behaviour while fixing parsing bug

Diff

 1diff --git a/lib/history.zsh b/lib/history.zsh
 2index c39c8c8667b17d72d0735cd736881fa78d09324d..56dda24627f747ee0e413c3a2e895a417045afe7 100644
 3--- a/lib/history.zsh
 4+++ b/lib/history.zsh
 5@@ -3,7 +3,10 @@ function omz_history {
 6   local clear list
 7   zparseopts -E c=clear l=list
 8 
 9-  if [[ -n "$clear" ]]; then
10+  if [[ $# -eq 0 ]]; then
11+    # if no arguments provided, show full history starting from 1
12+    builtin fc -l 1
13+  elif [[ -n "$clear" ]]; then
14     # if -c provided, clobber the history file
15     echo -n >| "$HISTFILE"
16     fc -p "$HISTFILE"