summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCristian Consonni <cristian@balist.es>2018-07-13 13:14:15 +0200
committerMarc Cornellà <marc.cornella@live.com>2018-07-13 13:14:15 +0200
commitd3e3b2dd0d7c7574d2a47c0d3a0d79583c58b2b8 (patch)
treeddd9d00fdd50512ee7c6873adb2baae969831a8b
parentf88396e3271b2459e92dfef37ed773fd01c446b8 (diff)
downloadzsh-d3e3b2dd0d7c7574d2a47c0d3a0d79583c58b2b8.tar.gz
zsh-d3e3b2dd0d7c7574d2a47c0d3a0d79583c58b2b8.tar.bz2
zsh-d3e3b2dd0d7c7574d2a47c0d3a0d79583c58b2b8.zip
Add support for custom timestamp format in history (#6770)
-rw-r--r--lib/history.zsh3
-rw-r--r--templates/zshrc.zsh-template5
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/history.zsh b/lib/history.zsh
index 7d4e59d00..62e02648b 100644
--- a/lib/history.zsh
+++ b/lib/history.zsh
@@ -23,7 +23,8 @@ case $HIST_STAMPS in
"mm/dd/yyyy") alias history='omz_history -f' ;;
"dd.mm.yyyy") alias history='omz_history -E' ;;
"yyyy-mm-dd") alias history='omz_history -i' ;;
- *) alias history='omz_history' ;;
+ "") alias history='omz_history' ;;
+ *) alias history="omz_history -t '$HIST_STAMPS'" ;;
esac
## History file configuration
diff --git a/templates/zshrc.zsh-template b/templates/zshrc.zsh-template
index bba2d370d..5f98fb211 100644
--- a/templates/zshrc.zsh-template
+++ b/templates/zshrc.zsh-template
@@ -48,7 +48,10 @@ ZSH_THEME="robbyrussell"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
-# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
+# You can set one of the optional three formats:
+# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
+# or set a custom format using the strftime function format specifications,
+# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?