zsh-users
 help / color / mirror / code / Atom feed
* show timestamp during history search ?
@ 2015-01-23 19:05 Andy Spiegl
  2015-01-23 20:10 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Andy Spiegl @ 2015-01-23 19:05 UTC (permalink / raw)
  To: zsh-users

Hi, just had an idea:  I'd consider it really useful while searching
backwards through the shell history to see the time when this command
was actually run.  I've got EXTENDED_HISTORY set, of course. :-)
Unfortunately I am clueless on how to implement this feature.
Maybe some kind of function bound to ctrl-r ?

Any help is appreciated!

Have a nice weekend!
 Andy.


-- 
 The opossum is a very sophisticated animal.  It doesn't even get up
 until 5 or 6 pm.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: show timestamp during history search ?
  2015-01-23 19:05 show timestamp during history search ? Andy Spiegl
@ 2015-01-23 20:10 ` Peter Stephenson
  2015-01-27 20:42   ` Vincent Lefevre
  2015-01-30 18:40   ` Andy Spiegl
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Stephenson @ 2015-01-23 20:10 UTC (permalink / raw)
  To: zsh-users

On Fri, 23 Jan 2015 20:05:49 +0100
Andy Spiegl <zsh.Andy@spiegl.de> wrote:
> Hi, just had an idea:  I'd consider it really useful while searching
> backwards through the shell history to see the time when this command
> was actually run.  I've got EXTENDED_HISTORY set, of course. :-)
> Unfortunately I am clueless on how to implement this feature.
> Maybe some kind of function bound to ctrl-r ?

zle-isearch-update() { zle -M "$(history -i $HISTNO $HISTNO)"; } 
zle-isearch-exit() { zle -M ''; }
zle -N zle-isearch-update
zle -N zle-isearch-exit


Bit annoying, I was hoping for something more complicated.  Can probably
be enhanced.

pws


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: show timestamp during history search ?
  2015-01-23 20:10 ` Peter Stephenson
@ 2015-01-27 20:42   ` Vincent Lefevre
  2015-01-30 18:40   ` Andy Spiegl
  1 sibling, 0 replies; 4+ messages in thread
From: Vincent Lefevre @ 2015-01-27 20:42 UTC (permalink / raw)
  To: zsh-users

On 2015-01-23 20:10:34 +0000, Peter Stephenson wrote:
> On Fri, 23 Jan 2015 20:05:49 +0100
> Andy Spiegl <zsh.Andy@spiegl.de> wrote:
> > Hi, just had an idea:  I'd consider it really useful while searching
> > backwards through the shell history to see the time when this command
> > was actually run.  I've got EXTENDED_HISTORY set, of course. :-)
> > Unfortunately I am clueless on how to implement this feature.
> > Maybe some kind of function bound to ctrl-r ?
> 
> zle-isearch-update() { zle -M "$(history -i $HISTNO $HISTNO)"; } 
> zle-isearch-exit() { zle -M ''; }
> zle -N zle-isearch-update
> zle -N zle-isearch-exit
> 
> Bit annoying, I was hoping for something more complicated.  Can probably
> be enhanced.

For long commands (i.e. which take several physical lines), some lines
are not cleared when typing ^U (kill-whole-line).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: show timestamp during history search ?
  2015-01-23 20:10 ` Peter Stephenson
  2015-01-27 20:42   ` Vincent Lefevre
@ 2015-01-30 18:40   ` Andy Spiegl
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Spiegl @ 2015-01-30 18:40 UTC (permalink / raw)
  To: zsh-users

> zle-isearch-update() { zle -M "$(history -i $HISTNO $HISTNO)"; }
> zle-isearch-exit() { zle -M ''; }
> zle -N zle-isearch-update
> zle -N zle-isearch-exit

Very cool, thanks!
I trimmed it down to date+time like so:
 zle-isearch-update() { zle -M "$(history -i $HISTNO $HISTNO | awk '{ print $2,$3 }')"; }

Then, I tried to put it to the right side of the screen (like RPROMPT)
but failed.  Probably not a good idea anyway because most of the time
there won't be enough space.

Thanks again!
 Andy.


-- 
 An opinion should be the result of thought, not a substitute for it.
   (Jef Mallett)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-01-30 18:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23 19:05 show timestamp during history search ? Andy Spiegl
2015-01-23 20:10 ` Peter Stephenson
2015-01-27 20:42   ` Vincent Lefevre
2015-01-30 18:40   ` Andy Spiegl

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).