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

controlling what goes in the history, or editing history in place?



Hi everybody,

I have all sorts of evil ideas for tweaking the history mechanism,
but it doesn't seem to be flexible enough for some of them.

- Is it possible to have some commands not be put into the internal
  history list, or not be saved when the list gets dumped to the .history
  file?

- Is it possible to scroll back to a previous command, change the line,
  and have the old history entry change?  (As opposed to creating a new
  history entry.)  Or is it possible to delete the old history entry?

As far as I can tell, things go into the history and then may be removed
by the various HIST... options.  It might be more useful (when writing
lots of extensions) to have things NOT go into the history unless
explicitly allowed.

BTW, some of the evil ideas are:

- If a command caused a syntax error, keep it in the internal history
  but don't save it to the .history file.

- A scheme to save sequences of commands in the history, so that you
  type the first one and then can go automatically through the rest
  (the infer-next zle widgets could do that, though they would need
  to know where the sequences end).

- Ditto with some kind of automatic pattern-matching predictor (if you
  did "ls a" followed by "rm a", then "ls b" sometime later, your next
  command might well be "rm b").  Yes, I realize this is incredibly
  dangerous.  Maybe the commands could be stuffed into the zle buffer
  instead of just being inserted at the prompt.

The point is to make the history a more specialized and intelligent tool,
not just an undifferentiated list.  BTW I'd rather have shell functions
than a huge number of specialized options.

-- Derek



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