From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3688 invoked by alias); 13 Aug 2015 10:34:39 -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: 20404 Received: (qmail 13630 invoked from network); 13 Aug 2015 10:34:37 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) 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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.0 X-AuditID: cbfec7f4-f79c56d0000012ee-15-55cc705f9f04 Date: Thu, 13 Aug 2015 11:24:22 +0100 From: Peter Stephenson To: Zsh Users Subject: Re: "expanding" to copy-earlier-word Message-id: <20150813112422.52f8cc84@pwslap01u.europe.root.pri> In-reply-to: <20150813095727.GA19151@linux.vnet.ibm.com> References: <20150813095727.GA19151@linux.vnet.ibm.com> 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+NgFjrALMWRmVeSWpSXmKPExsVy+t/xK7rxBWdCDW6u4rHYcXIlowOjx6qD H5gCGKO4bFJSczLLUov07RK4Mp7vMi34w1Hx9ecc5gbGPvYuRk4OCQETiaOztkDZYhIX7q1n 62Lk4hASWMoo8eLhNBaQhJDANCaJGx/NIBLbGCW2rlkH1MHBwSKgKvH8uDFIDZuAocTUTbMZ QWwRAUWJM7++MYHYwgK6EusvLmIDsXkF7CVm9exnBWnlFLCQ6J1RDDHeXOJn2w2wG/gF9CWu /v3EBHGPvcTMK2cYIVoFJX5Mvgd2DrOAlsTmbU2sELa8xOY1b5kh5qhL3Li7m30Co9AsJC2z kLTMQtKygJF5FaNoamlyQXFSeq6hXnFibnFpXrpecn7uJkZIuH7Zwbj4mNUhRgEORiUe3g2P TocKsSaWFVfmHmKU4GBWEuG9l3YmVIg3JbGyKrUoP76oNCe1+BCjNAeLkjjv3F3vQ4QE0hNL UrNTUwtSi2CyTBycUg2MhV31MYe5096UJWlltLv7709xOiv1SYxv4vmEgHXrO5pdQ+3P5Lf/ cV3wxW7r50W+W3VOLzzZGvhsdeOjTQscLiy9rL5TW/PzkbiE1o8BX05fmWlQ09N658bq2+3y 1XeErt36Ot/tiqjR7zdKXKwX9Rbz7nd6ztdo8+Lf5WBH2+v7qyJmeb0sUWIpzkg01GIuKk4E APSyK1pTAgAA On Thu, 13 Aug 2015 10:57:27 +0100 Dominik Vogt wrote: > I've bound ctrl-j to copy-earlier-word, so I can copy the last word > of the previously executed command line to the current command > line. Is there a way to do the same as part of the expansion > process? Hisotry expansion allows you to select previous words, but you'll need to count from the left when retrieving words from the current line: you can use ":$" to indicate the last argument, which with !# is the previous argument, but "-" indicates a range, not a negative offset. There was some discussion about this anomaly a couple of months ago; it's potentially fixable with some new syntax (I've forgotten if there was a conclusion). > What I'd like to have this something like this: > > $ make foo > $ ./ ./!:$ > or even > > $ make foo; ./ make foo; ./!#:1 (remember history expansion starts with word 0). Unfortunately !#:$ gets you the ";" because while history expansion knows about dividing into words it doesn't know which words are syntactically important. pws