Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom timestamp format in history #6770

Merged
merged 2 commits into from
Jul 13, 2018

Conversation

CristianCantoro
Copy link
Contributor

As per discussion in #6589, this PR adds the ability to define a custom format for timestamps shown by the history command.

  1. If HIST_STAMPS is unset or empty the default behavior is maintained and no timestamps are shown.
  2. The custom formats mm/dd/yyy, dd.mm.yyyy, and yyyy-mm-dd are kept as well.
  3. Otherwise HIST_STAMPS is used as a format string passed to the fc command via the -t option. The format string — as per fc's manual — "is formatted with the strftime function with the zsh extensions described for the %D{string} prompt format in Prompt Expansion." . More info on the accepted escape sequences are available via man strftime.

The PR also updates the zshrc.zsh-template template with instructions.

See issue #6109, for further background.

@mcornella
Copy link
Member

I've updated your PR to simplify the case logic to include if $HIST_STAMPS is empty or undefined. Thanks for your contribution!

@mcornella mcornella merged commit d3e3b2d into ohmyzsh:master Jul 13, 2018
bjornreppen pushed a commit to bjornreppen/oh-my-zsh that referenced this pull request Aug 11, 2018
lellisls pushed a commit to lellisls/oh-my-zsh that referenced this pull request Oct 1, 2018
seth-cohen pushed a commit to seth-cohen/oh-my-zsh that referenced this pull request Oct 29, 2018
jmartindf pushed a commit to jmartindf/oh-my-zsh that referenced this pull request Nov 10, 2018
sagischwarz pushed a commit to sagischwarz/ohmyzsh that referenced this pull request Nov 19, 2018
chihchun pushed a commit to chihchun/oh-my-zsh that referenced this pull request Aug 6, 2019
kankongmeng pushed a commit to kankongmeng/oh-my-zsh that referenced this pull request Jan 8, 2020
spiliopoulos pushed a commit to spiliopoulos/zsh-config that referenced this pull request Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants