eafa78217d836115a99f80bddfcd0a8901a15f77

Author
Marc Cornellà <marc@mcornella.com>
Committer
Marc Cornellà <marc@mcornella.com>
Date

Message

fix(history): fix `history -c` (#12362)

Fixes #12362

Diff

 1diff --git a/lib/history.zsh b/lib/history.zsh
 2index ec89bc15eb6d3bcddc17ac9a2bdcf6286744e401..aace78aa1e7d1e956ee62f6252efc586f1bfce78 100644
 3--- a/lib/history.zsh
 4+++ b/lib/history.zsh
 5@@ -4,14 +4,14 @@ function omz_history {
 6   local clear list stamp
 7   zparseopts -E -D c=clear l=list f=stamp E=stamp i=stamp
 8 
 9-  if [[ $# -eq 0 ]]; then
10-    # if no arguments provided, show full history starting from 1
11-    builtin fc $stamp -l 1
12-  elif [[ -n "$clear" ]]; then
13+  if [[ -n "$clear" ]]; then
14     # if -c provided, clobber the history file
15     echo -n >| "$HISTFILE"
16     fc -p "$HISTFILE"
17     echo >&2 History file deleted.
18+  elif [[ $# -eq 0 ]]; then
19+    # if no arguments provided, show full history starting from 1
20+    builtin fc $stamp -l 1
21   else
22     # otherwise, run `fc -l` with a custom format
23     builtin fc $stamp -l "$@"