Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: how to clean a history entry?



On Tue, Jan 04, 2005 at 06:40:10PM +0000, Peter Stephenson wrote:
> Might not be difficult to add as a feature, since internally history
> is held as a linked list.  I can certainly see the use in it when
> you're reexecuting chunks of the history.

The basic idea would be quite easy to implement, but it gets a little
more complicated if the user is using an option such as SHARE_HISTORY
since the history item might have already made its way into other shell
instances through the shared history file.  I suppose just making the
current shell dump the line and then re-writing the history file to
remove the line would be a good enough first implementation, though (as
the user could manually deal with any propagation of the command).

And, as long as I'm talking about history-related items, it would be
nice to brain-storm some ideas on how to improve the recall of desirable
prior commands.  I tend to use HIST_IGNORE_SPACE and an absurd amount of
leading-space commands to keep my history list limited to mainly just
the commands that I think I will need to re-run.  I also use the kill
ring and Ctrl-Q to remember various commands that I need to re-run in
the near term, but that I don't want to get in the way of my use of
Ctrl-R to find prior well-used commands.  This means that I tend to
inconvenience myself by needing to take extra steps to re-run less-used
commands, and that I don't use word-delete much at all.

It would be nice to improve on this somehow (perhaps via options that
I'm not aware of) so that the history could go back to being a list of
all the (non-sensitive) commands I typed and still allow me to find my
favorite commands easily.  Perhaps some sort of a "bookmark" system that
allows me to store off and recall my most favorite commands.  Or perhaps
a way to search through the history in most-used order (in addition to
most-recent order) so that a recently-run rsync command doesn't get in
the way of my most-used rsync commands (unless I want it to).  It would
be nice to have a way to specify user-selectable matching for commands
that should not be stored.  Perhaps even a rewriting system that could
let a command be stored, but with its sensitive info XXXed out (allowing
the user to re-run it by just re-inserting the missing info).  And an
option to expire the history list based on LRU order might be good too.

Does any of that sound good?  Am I missing some existing zsh features?
Any other ideas for how to make command-reuse easier?

..wayne..



Messages sorted by: Reverse Date, Date, Thread, Author