2004-05-28, 14:12(+02), Gabkin:
Quote:> As for zsh, I'm a bash man! (but does zsh have an evolutionary history
> facility like this?)
Yes, and much more. Some customizations possible for history:
If this is set, zsh sessions will append their history list to the
history file, rather than overwrite it. Thus, multiple parallel
zsh sessions will all have their history lists added to the
history file, in the order they are killed.
Save each command's beginning timestamp (in seconds since the
epoch) and the duration (in seconds) to the history file. The
format of this prefixed data is:
`:<BEGINNING TIME>:<ELAPSED SECONDS>:<COMMAND>'.
Add `|' to output redirections in the history. This allows history
references to clobber files even when CLOBBER is unset.
Beep when an attempt is made to access a history entry which isn't
If the internal history needs to be trimmed to add the current
command line, setting this option will cause the oldest history
event that has a duplicate to be lost before losing a unique event
from the list. You should be sure to set the value of HISTSIZE to
a larger number than SAVEHIST in order to give you some room for
the duplicated events, otherwise this option will behave just like
HIST_IGNORE_ALL_DUPS once the history fills up with unique events.
When searching for history entries in the line editor, do not
display duplicates of a line previously found, even if the
duplicates are not contiguous.
If a new command line being added to the history list duplicates an
older one, the older command is removed from the list (even if it
is not the previous event).
Do not enter command lines into the history list if they are
duplicates of the previous event.
Remove command lines from the history list when the first
character on the line is a space, or when one of the expanded
aliases contains a leading space. Note that the command lingers
in the internal history until the next command is entered before
it vanishes, allowing you to briefly reuse or edit the line. If
you want to make it vanish right away without entering another
command, type a space and press return.
Remove function definitions from the history list. Note that the
function lingers in the internal history until the next command is
entered before it vanishes, allowing you to briefly reuse or edit
Remove the history (fc -l) command from the history list when
invoked. Note that the command lingers in the internal history
until the next command is entered before it vanishes, allowing you
to briefly reuse or edit the line.
Remove superfluous blanks from each command line being added to
the history list.
When writing out the history file, older commands that duplicate
newer ones are omitted.
Whenever the user enters a line with history expansion, don't
execute the line directly; instead, perform history expansion and
reload the line into the editing buffer.
This options works like APPEND_HISTORY except that new history
lines are added to the $HISTFILE incrementally (as soon as they are
entered), rather than waiting until the shell is killed. The file
is periodically trimmed to the number of lines specified by
$SAVEHIST, but can exceed this value between t*s.
This option both imports new commands from the history file, and
also causes your typed commands to be appended to the history file
(the latter is like specifying INC_APPEND_HISTORY). The history
lines are also output with timestamps ala EXTENDED_HISTORY (which
makes it easier to find the spot where we left off reading the
file after it gets re-written).
By default, history movement commands visit the imported lines as
well as the local lines, but you can toggle this on and off with
the set-local-history zle binding. It is also possible to create
a zle widget that will make some commands ignore imported
commands, and some include them.
If you find that you want more control over when commands get
imported, you may wish to turn SHARE_HISTORY off,
INC_APPEND_HISTORY on, and then manually import commands whenever
you need them using `fc -RI'.
setopt HIST_IGNORE_ALL_DUPS HIST_REDUCE_BLANKS \
HIST_SAVE_NO_DUPS HIST_VERIFY INC_APPEND_HISTORY NO_BANG_HIST