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

Re: how to clean a history entry?



Hello Peter,

> > I have one problem though, I didn't find the way to remove a specific
> > entry from the history ( in bash I can easily do this with the command
> > 'history -d <item_nr>').
> >
> > Anybody know how to do this?
>
> Hmm, I don't think this is too easy.
>
> If you know in advance that you don't want to save an entry, you can set
> the option histignorespace and enter a space before the command.  (Note
> that it won't disappear until you enter a new command; the immediately
> preceeding command is always still available with this option.)
>
> Otherwise, you can save the history (fc -A to append to what's there, fc
> -W to overwrite), delete the line from the history file, and read it
> with fc -R.  That can probably be turned into a function.  It's a bit
> clumsy.
>
> 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.

It would be very nice to add this as a feature! Do you know what is the proper 
procedure to request it to developers?

I really use that feature in bash; sometimes I forgot to add the space in 
sensitive commands that I don't want to appear in the history (like typing 
passwords). Nevertheless, it's a small inconvenience in comparison with all 
the benefits I get from zsh :)

Regards,
Toshiro.



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