From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28422 invoked by alias); 7 Mar 2014 07:07:52 -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: 18570 Received: (qmail 21517 invoked from network); 7 Mar 2014 07:07:37 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@zsh.org From: Jan Larres Subject: Re: Local/global history with pattern isearch Date: Fri, 07 Mar 2014 19:49:07 +1300 Message-ID: References: <140302214400.ZM1868@torch.brasslantern.com> <140305205344.ZM5782@torch.brasslantern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: yass.opencloud.co.nz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 In-Reply-To: <140305205344.ZM5782@torch.brasslantern.com> On 06/03/14 17:53, Bart Schaefer wrote: > On Mar 4, 12:44pm, Jan Larres wrote: > } > } Okay, the good news first: I found the culprit! The issue was caused by > } the zsh-syntax-highlighting script > > Hmm. I don't use that, but looking at it, it should be the case that if > you define your widget first then it will skip trying to redefine it, > and if you define yours second then yours will replace the highlighting > one. (This is all because your widget has the same name as a builtin.) > > That explains why > } ... a quick swapping of order doesn't seem to make any > } difference. This got me wondering why it wasn't working even though the search widget got left alone, and so I went trying to figure out which widget *was* the issue. And, possibly to no-one's surprise, that widget turned out to be set-local-history. If I redefine that widget so it won't get redefined again by zsh-syntax-highlighting then the local/global history functionality works perfectly together with pattern-search. Apparently the calling of an additional function after that widget confuses it somehow. So for those playing along at home this is what I currently have in my .zshrc: set-local-history() { zle .set-local-history } zle -N set-local-history zle-line-init() { NUMERIC=1 zle set-local-history } zle -N zle-line-init zle-isearch-update() { NUMERIC=0 zle set-local-history } zle -N zle-isearch-update zle-isearch-exit() { NUMERIC=1 zle set-local-history } zle -N zle-isearch-exit history-incremental-pattern-search-backward() { NUMERIC=0 zle set-local-history zle .history-incremental-pattern-search-backward "$@" } zle -N history-incremental-pattern-search-backward bindkey '^r' history-incremental-pattern-search-backward history-incremental-pattern-search-forward() { NUMERIC=0 zle set-local-history zle .history-incremental-pattern-search-forward "$@" } zle -N history-incremental-pattern-search-forward bindkey '^s' history-incremental-pattern-search-forward Thanks for the help, Bart! -Jan