From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20296 invoked by alias); 14 Mar 2013 12:06:58 -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: 17695 Received: (qmail 976 invoked from network); 14 Mar 2013 12:06:57 -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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at de.ibm.com designates 195.75.94.110 as permitted sender) Subject: searching words in history similar to insert-last-word X-KeepSent: B4919E60:BB31A680-C1257B2E:0040C2F4; type=4; name=$KeepSent To: zsh-users@zsh.org X-Mailer: Lotus Notes Release 8.5.3 September 15, 2011 Message-ID: From: Dominik Vogt Date: Thu, 14 Mar 2013 13:06:39 +0100 X-MIMETrack: Serialize by Router on D06ML035/06/M/IBM(Release 8.5.3FP2 ZX853FP2HF3|December 12, 2012) at 14/03/2013 13:06:39 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII X-TM-AS-MML: No x-cbid: 13031412-1948-0000-0000-0000048DE8E3 Hi folks, I'm looking for a way to complete the last word I'm typing on the command line by doing a history search. With Alt-. (insert-last-word) I can browse through the last words of the previous lines, but I'm looking for something more clever. My use case is this: I'm copying files to remote machines with scp, e.g. $ scp foo user@machine1.domain: $ scp bar baz .* user@machine2.domain: I'd like to be able to simplify this by being able to type $ scp xyz user@ to yield $ scp xyz user@machine1.domain: When I press repeatedly, zsh should replace the last word on the line with words from the history that begin with "user@". The function name might be something like "beginning-search-up". Some extra features or options would be: 1. Ignore the first word of each line but look through all other words on each history line. 2. (If the word that is to be completed is the first word on the line, only consider the first word of all history lines.) 3. Allow searching in the other direction with . -- And as a related but seperate issue: How can I make a function that works like insert-last-word but works in the opposite direction (insert-next-word). This would of course only be usefull if I use insert-last-word first. Ciao Dominik ^_^ ^_^