From eafa78217d836115a99f80bddfcd0a8901a15f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 18 Apr 2024 07:12:32 +0200 Subject: [PATCH] fix(history): fix `history -c` (#12362) Fixes #12362 --- lib/history.zsh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/history.zsh b/lib/history.zsh index ec89bc15e..aace78aa1 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -4,14 +4,14 @@ function omz_history { local clear list stamp zparseopts -E -D c=clear l=list f=stamp E=stamp i=stamp - if [[ $# -eq 0 ]]; then - # if no arguments provided, show full history starting from 1 - builtin fc $stamp -l 1 - elif [[ -n "$clear" ]]; then + if [[ -n "$clear" ]]; then # if -c provided, clobber the history file echo -n >| "$HISTFILE" fc -p "$HISTFILE" echo >&2 History file deleted. + elif [[ $# -eq 0 ]]; then + # if no arguments provided, show full history starting from 1 + builtin fc $stamp -l 1 else # otherwise, run `fc -l` with a custom format builtin fc $stamp -l "$@"