zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh Users <zsh-users@zsh.org>
Subject: Re: Hiding command from history
Date: Tue, 03 Feb 2015 16:39:11 +0000	[thread overview]
Message-ID: <20150203163911.55d564df@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <20150203140242.382b2e64@pwslap01u.europe.root.pri>

On Tue, 3 Feb 2015 14:02:42 +0000
Peter Stephenson <p.stephenson@samsung.com> wrote:
> zshaddhistory() { [[ $1 != ${~HISTORY_IGNORE} ]]; }

Worth mentioning.

pws

diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 391a5fb..ee7c054 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -1052,10 +1052,25 @@ item(tt(HISTORY_IGNORE))(
 If set, is treated as a pattern at the time history files are written.
 Any potential history entry that matches the pattern is skipped.  For
 example, if the value is `tt(fc *)' then commands that invoke the
-interactive history editor are never written to the history file (compare
-the tt(HIST_NO_STORE) option or the tt(zshaddhistory) hook, either of
-which would prevent such commands from being added to the interactive
-history at all).
+interactive history editor are never written to the history file.
+
+Note that tt(HISTORY_IGNORE) defines a single pattern: to
+specify alternatives use the `tt(+LPAR()first|second|...+RPAR())'
+syntax.
+
+Compare the tt(HIST_NO_STORE) option or the tt(zshaddhistory) hook,
+either of which would prevent such commands from being added to the
+interactive history at all.  If you wish to use tt(HISTORY_IGNORE) to
+stop history being added in the first place, you can define the
+following hook:
+
+example(zshaddhistory+LPAR()RPAR() {
+  emulate -L zsh
+  ## uncomment if HISTORY_IGNORE
+  ## should use EXTENDED_GLOB syntax
+  # setopt extendedglob
+  [[ $1 != ${~HISTORY_IGNORE} ]]
+})
 )
 vindex(HISTSIZE)
 item(tt(HISTSIZE) <S>)(


  parent reply	other threads:[~2015-02-03 16:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 11:29 İsmail Dönmez
2015-02-03 12:13 ` Peter Stephenson
2015-02-03 12:34   ` İsmail Dönmez
2015-02-03 12:47     ` Peter Stephenson
2015-02-03 13:06       ` İsmail Dönmez
2015-02-03 13:49         ` İsmail Dönmez
2015-02-03 14:02           ` Peter Stephenson
2015-02-03 14:07             ` İsmail Dönmez
2015-02-03 16:39             ` Peter Stephenson [this message]
2015-02-03 12:37   ` Peter Stephenson
2015-02-04 17:35     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150203163911.55d564df@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).