From d33b0aae917c62012bf203538ba86d6236869834 Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Fri, 10 Jan 2014 23:50:19 +0100 Subject: [PATCH] Refactors history alias and moves it. More compact case statement instead of the ugly if elif... else statement. Moves it to history.zsh --- lib/aliases.zsh | 14 -------------- lib/history.zsh | 9 +++++++++ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lib/aliases.zsh b/lib/aliases.zsh index c67f854a7..da29fde58 100644 --- a/lib/aliases.zsh +++ b/lib/aliases.zsh @@ -4,19 +4,5 @@ alias please='sudo' #alias g='grep -in' -# Show history -if [ "$HIST_STAMPS" = "mm/dd/yyyy" ] -then - alias history='fc -fl 1' -elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ] -then - alias history='fc -El 1' -elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ] -then - alias history='fc -il 1' -else - alias history='fc -l 1' -fi - alias afind='ack-grep -il' diff --git a/lib/history.zsh b/lib/history.zsh index e78a98e9e..5de71c2d3 100644 --- a/lib/history.zsh +++ b/lib/history.zsh @@ -6,6 +6,15 @@ fi HISTSIZE=10000 SAVEHIST=10000 +# Show history +case $HIST_STAMPS in + "mm/dd/yyyy") alias history='fc -fl 1' ;; + "dd.mm.yyyy") alias history='fc -El 1' ;; + "yyyy-mm-dd") alias history='fc -il 1' ;; + *) alias history='fc -l 1' ;; +esac + +setopt append_history setopt extended_history setopt hist_expire_dups_first setopt hist_ignore_dups # ignore duplication command history list