Add support for custom timestamp format in history (#6770)
Diff
1diff --git a/lib/history.zsh b/lib/history.zsh
2index 7d4e59d0058ceb33c5305a6616291dc4a2b75f8c..62e02648b50216e59eb0ba1fb03d00b3bdf8025c 100644
3--- a/lib/history.zsh
4+++ b/lib/history.zsh
5@@ -23,7 +23,8 @@ case $HIST_STAMPS in
6 "mm/dd/yyyy") alias history='omz_history -f' ;;
7 "dd.mm.yyyy") alias history='omz_history -E' ;;
8 "yyyy-mm-dd") alias history='omz_history -i' ;;
9- *) alias history='omz_history' ;;
10+ "") alias history='omz_history' ;;
11+ *) alias history="omz_history -t '$HIST_STAMPS'" ;;
12 esac
1314 ## History file configuration
15diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template
16index bba2d370d673fefad3e2fa09cbfc0eb074038e46..5f98fb21119595daf93485348ba9b5e9e05d6c07 100644
17--- a/templates/zshrc.zsh-template
18+++ b/templates/zshrc.zsh-template
19@@ -48,7 +48,10 @@ ZSH_THEME="robbyrussell"
2021 # Uncomment the following line if you want to change the command execution time
22 # stamp shown in the history command output.
23-# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
24+# You can set one of the optional three formats:
25+# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
26+# or set a custom format using the strftime function format specifications,
27+# see 'man strftime' for details.
28 # HIST_STAMPS="mm/dd/yyyy"
2930 # Would you like to use another custom folder than $ZSH/custom?