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

Re: Makeing history harmless



On 2006-10-12 at 09:15 -0400, Chris Johnson wrote:
> Phil Pennock sent me the following 0.9K:
> > On 2006-10-12 at 04:47 +0200, Meino Christian Cramer wrote:
> > >  Is it possible to write a "something" to filter out certain commands 
> > >  or to modify certain commands before they were copied from the
> > >  commandline into the history ?

> I do this with:

I do neither, I was just helping the OP, Meino.  :^)

>    setopt hist_ignore_space
>    alias rm=' rm'
> 
> Is there an advantage to using the widget?

Not really, unless you want to avoid global aliases whilst writing
something which can special-case things like "svn rm"; you could have
nested case statements examining different items in ${(z)BUFFER} and
possibly triggering other effects too.  Heck, build a whole new dispatch
system for command hooks, a la compsys.  ;^)

In summary, zsh is mighty and there's more than one way to do it.

-Phil



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