From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21526 invoked by alias); 3 Feb 2015 16:39:20 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19800 Received: (qmail 20107 invoked from network); 3 Feb 2015 16:39:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_PASS autolearn=ham version=3.3.2 X-AuditID: cbfec7f4-b7f126d000001e9a-f5-54d0f922bed4 Date: Tue, 03 Feb 2015 16:39:11 +0000 From: Peter Stephenson To: Zsh Users Subject: Re: Hiding command from history Message-id: <20150203163911.55d564df@pwslap01u.europe.root.pri> In-reply-to: <20150203140242.382b2e64@pwslap01u.europe.root.pri> References: <20150203121349.53f135fd@pwslap01u.europe.root.pri> <20150203124708.443404f0@pwslap01u.europe.root.pri> <20150203140242.382b2e64@pwslap01u.europe.root.pri> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOLMWRmVeSWpSXmKPExsVy+t/xy7pKPy+EGLz8pGmx4+RKRgdGj1UH PzAFMEZx2aSk5mSWpRbp2yVwZUw5d4ClYB5PxfvVk9kaGPu4uhg5OSQETCRW757FCGGLSVy4 t56ti5GLQ0hgKaPE5JWfWSCcRUwSD29tYoRwtjFKNC+9xQLSwiKgKrHz1Q9WEJtNwFBi6qbZ YKNEBBQlzvz6xgRiCwtoSJxauZoNxOYVsJdY8+sQWD2ngIPE8jMTmSCGnmSW+DrtDTtIgl9A X+Lq309MEDfZS8y8coYRollQ4sfke2CLmQW0JDZva2KFsOUlNq95ywxiCwmoS9y4u5t9AqPQ LCQts5C0zELSsoCReRWjaGppckFxUnquoV5xYm5xaV66XnJ+7iZGSOB+2cG4+JjVIUYBDkYl Ht4VRhdChFgTy4orcw8xSnAwK4nwPn8DFOJNSaysSi3Kjy8qzUktPsTIxMEp1cC4sEmQtdZa /n627A2RJRqLkkRuROy4+XSdlxens9yLJ33xAc+ZA2/IxVeZtpT5X2nc2HRCtSA1a0eI43rx sOg7sXUNoU4PX1VfVZ25KV708qNvoq88RNybMwOFuDa8efMi//Gmjw9v3Ns/8cRrrx89D+Of s19kcmUND7xVcVNq7rsuUaebkgeUWIozEg21mIuKEwFXdwrIOgIAAA== On Tue, 3 Feb 2015 14:02:42 +0000 Peter Stephenson 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) )(