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

Re: History



On Sep 11,  1:42pm, GoTaR wrote:
} 
} So removing from history is possible only by leading space, not by
} configurable pattern, is it right? :/

That is correct.  There was some discussion several months ago of having
a pattern match for history exclusion, but it didn't lead to anything.

It is, however, possible to selectively insert into the history commands
that would otherwise be ignored.  Try something like this:

  setopt hist_ignore_space
  alias cd=' builtin cd'
  function preexec {
    if [[ "$1" = 'cd '* && "$1" != 'cd "`echo '*'`"' ]]
    then
      print -s "$1"	# explicitly add it to the history
    # else it already will be in the history, so do nothing
    fi
  }



-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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