Menu

#128 Add a time prefix based on $HISTTIMEFORMAT

open
nobody
2015-02-13
2015-02-13
Anonymous
No

Originally created by: nkoester
Originally owned by: dvorka

(This is a follow-up to [#124] - awesome job on that ;))

I suppose it would be a somewhat nice feature to read $HISTTIMEFORMAT and add this as a time prefix to each command displayed in hstr.

so current setting when calling hstr is:


nkoester@calcit$ install
Type to filter, UP/DOWN move, DEL remove, TAB select, C-f add favorite, C-g cancel
- HISTORY - view:ranking (C-/) - match:exact (C-e) - case:insensitive (C-t) - 1182/1497/1 --------------------------------------------
python setup.py install --prefix=/homes/nkoester/sandboxes/ocvf
mvn -P citec install

And from setting something like this:


export HISTTIMEFORMAT='%F %T '

I could imagine this:


nkoester@calcit$ install
Type to filter, UP/DOWN move, DEL remove, TAB select, C-f add favorite, C-g cancel
- HISTORY - view:ranking (C-/) - match:exact (C-e) - case:insensitive (C-t) - 1182/1497/1 --------------------------------------------
2015-02-13 10:58:50 python setup.py install --prefix=/homes/nkoester/sandboxes/ocvf
2015-02-13 11:09:28 mvn -P sanbox install

Considering that currently all lines with ^#\d+$ in the history are ignored, this is not a so straight forward task. It also is not urgent either, however I think documenting this here is useful. Maybe someone has time to have a look at this.

tl;dr:
use value of $HISTTIMEFORMAT as a format string for strftime(3) to print the time stamp as a prefix in hstr

Related

Tickets: #124

Discussion

  • Anonymous

    Anonymous - 2015-02-13

    Originally posted by: nkoester

    Bonus:
    Maybe it would be nice to add a match group for date

    You know.. when you executed that command last Thursday to do all your work but cant remember what it was! :flushed:

     

Log in to post a comment.