From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23110 invoked by alias); 6 Mar 2014 02:23:12 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32465 Received: (qmail 3360 invoked from network); 6 Mar 2014 02:23:06 -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 autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140305182236.ZM5695@torch.brasslantern.com> Date: Wed, 05 Mar 2014 18:22:36 -0800 In-reply-to: Comments: In reply to Timm Bla "Writing a plugin - where to start?" (Mar 4, 5:31pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Writing a plugin - where to start? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Mar 4, 5:31pm, Timm Bla wrote: } } I am new to zsh and I want to write a plugin. } } For that I need to be able to change the output of the history. } So that when the user goes back or forth in the history (with the arrow } keys for example) my plugin gives back the output the user will see. In addition to what PWS had to say ... - If you want to change the content of the history, rather than just the output of the history movement commands, then you probably want to look at the zshaddhistory hook. - If you want to leave the "real" history alone but change what the user sees, then you will need to create new widgets (see "zle -N") and either replace the key bindings (see the "bindkey" command) or name your new widgets to replace the default ones. - Widgets are shell functions that manipulate the editor; there are a couple of options for altering the behavior of history motions: 1. create your own history and use it in place of the "real" history by calling "fc -p" (probably "fc -pa"); or 2. assign your desired content directly to the BUFFER variable. If you want better advice, you'll need to provide more details.