d33b0aae917c62012bf203538ba86d6236869834
- Author
- LFDM <1986gh@gmail.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Refactors history alias and moves it.
More compact case statement instead of the ugly if elif... else
statement. Moves it to history.zsh
Diff
1diff --git a/lib/aliases.zsh b/lib/aliases.zsh
2index c67f854a73379bc0e25ae8fc245eafedbe37918d..da29fde58873f2b0a79833e3ca2898a0c5e62b7e 100644
3--- a/lib/aliases.zsh
4+++ b/lib/aliases.zsh
5@@ -4,19 +4,5 @@ alias please='sudo'
6
7 #alias g='grep -in'
8
9-# Show history
10-if [ "$HIST_STAMPS" = "mm/dd/yyyy" ]
11-then
12- alias history='fc -fl 1'
13-elif [ "$HIST_STAMPS" = "dd.mm.yyyy" ]
14-then
15- alias history='fc -El 1'
16-elif [ "$HIST_STAMPS" = "yyyy-mm-dd" ]
17-then
18- alias history='fc -il 1'
19-else
20- alias history='fc -l 1'
21-fi
22-
23 alias afind='ack-grep -il'
24
25diff --git a/lib/history.zsh b/lib/history.zsh
26index e78a98e9e8da4e9a11d101dfa6fa1ffd7e9f9c32..5de71c2d3e0fdd0296cc8d46da9fbd1724fd7a00 100644
27--- a/lib/history.zsh
28+++ b/lib/history.zsh
29@@ -6,6 +6,15 @@ fi
30 HISTSIZE=10000
31 SAVEHIST=10000
32
33+# Show history
34+case $HIST_STAMPS in
35+ "mm/dd/yyyy") alias history='fc -fl 1' ;;
36+ "dd.mm.yyyy") alias history='fc -El 1' ;;
37+ "yyyy-mm-dd") alias history='fc -il 1' ;;
38+ *) alias history='fc -l 1' ;;
39+esac
40+
41+setopt append_history
42 setopt extended_history
43 setopt hist_expire_dups_first
44 setopt hist_ignore_dups # ignore duplication command history list