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

Re: history related suggestions



Peter Stephenson wrote:

> > Along with this, I would suggest that parameter expansion be
> > done on the zle widget arguments each time the widget is run. This would
> > allow users to do:
> > bindkey '^[[A' up-line-or-history '$history_toggle'
> > and then change the $history_toggle variable to select between local and
> > shared history.
> 
> That sort of thing should certainly be done inside functions.
 
> Extra levels of expansion tend to make things a bit of a mess, and in my
> experience you always get to the point where you need the extra
flexibility
> of a function anyway.  (Cf. S. Wischnowsky, Collected New Completion

Fair enough if it's hard to implement but my thinking was that it would
allow a lot of problems to be solved more succinctly than by using a
function. 

Bart Schaefer wrote:

> } What I would also like is if these were numbered so that the most
> } recent one is the same as $HISTSIZE. This would mean that when I first
> } run zsh, the first command I type would be number 1, not 200.
> How would you refer in bang-syntax to the commands that precede 1 ?  They
> can't be given negative numbers; !-10 already means ten commands before
> the current command.

They would be numbered from $HISTSIZE downwards so for example, if you have
HISTSIZE=500 and SAVEHIST=100, they would be numbered from !401 to !500. I
always thought it would be better if the history numbers wrapped back to 1
once they reached $HISTSIZE rather than carrying on into the thousands. What
currently happens if $SAVEHIST is greater than $HISTSIZE?

> You could accomplish that by completly flushing and reloading the history
> from the shared file every time that the file changes, starting over at 1
> with the numbering each time -- but I think you'd rapidly find that it was
> more annoying than useful: the number that a command had a moment ago
> would no longer be the number it has now, so your reference to !4 might
> get the wrong thing.

Yup, that would be nasty. I mostly look at prompts back in my buffer for
history numbers rather than the output of fc. Having thought about it a bit
more, it would probably be quite hard to implement properly as shell's would
have to reserve the history number once they printed a prompt so forget the
suggestion.

Cheers

Oliver Kiddle



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