From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20184 invoked by alias); 31 Mar 2014 14:58:01 -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: 18693 Received: (qmail 7181 invoked from network); 31 Mar 2014 14:57:55 -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-b7f796d000005a13-1f-533980153605 Date: Mon, 31 Mar 2014 15:47:48 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: copy "real" previous word Message-id: <20140331154748.1dc7cf27@pwslap01u.europe.root.pri> In-reply-to: References: 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+NgFuplluLIzCtJLcpLzFFi42I5/e/4FV3RBstggx/X1Cx2nFzJ6MDoserg B6YAxigum5TUnMyy1CJ9uwSujB8PWxgL1rFXHF85lb2B8Q1rFyMnh4SAicSxrffZIGwxiQv3 1gPZXBxCAksZJW5u7GSEcpgkzr6azgxSxSKgKnHm4z+wDjYBQ4mpm2YzgtgiAqISy1dsZgex hQXUJDYfm8AEYvMK2Evcuv4crJ5TwFbiwPQpLCC2kICNxMqty8Bq+AX0Ja7+/cQEcYW9xMwr ZxghegUlfky+B1bPLKAlsXlbEyuELS+xec1b5gmMArOQlM1CUjYLSdkCRuZVjKKppckFxUnp uYZ6xYm5xaV56XrJ+bmbGCFB+GUH4+JjVocYBTgYlXh4Lcotg4VYE8uKK3MPMUpwMCuJ8GaV AoV4UxIrq1KL8uOLSnNSiw8xMnFwSjUw6nuY3Z4ZI3e62suzpu4Fv6/9GXmdf5z/vX0LZ+22 a7ba+p1/l0/+3a7nHxJ/JbfsDFVaXJl9gi99zVObid4pQrrfF5mwlR9MLWqY6lBWIuX97S+H 7UWjZaErjGbl1mdurciaKjzxyqxD7MwzZhdeePTOh9No77Nrs+dqCXa0B4QftT0kuYpTiaU4 I9FQi7moOBEARr+WbSACAAA= On Mon, 31 Mar 2014 14:29:25 +0000 (UTC) zzapper wrote: > bindkey -M viins '^O' copy-prev-shell-word > > cp fred.php old_ > > gives me > > cp fred.php old_old_ > > when I wanted > > cp fred.php old_fred.php Try using the user-defined widget copy-earlier-word --- it still starts by copying the immediately preceeding word chunk, but you can repeat it to copy what's before that. So you just need to type ^O twice. It's an interesting (but not *that* interesting) student excercise to make a widget to do exactly what (I think) you want: test if there's white space before the cursor, if so call copy-earlier-word once, else call it twice. For bonus points (now this is getting a bit interesting) check if the whitespace might be part of an uncompleted quoted argument. (Second time in a week I've found myself getting confused between "word" and "argument"...) pws