Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: copy "real" previous word
- X-seq: zsh-users 18693
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: copy "real" previous word
- Date: Mon, 31 Mar 2014 15:47:48 +0100
- In-reply-to: <XnsA3019D93A244Edavidrayninfocouk@80.91.229.13>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Organization: Samsung Cambridge Solution Centre
- References: <XnsA3019D93A244Edavidrayninfocouk@80.91.229.13>
On Mon, 31 Mar 2014 14:29:25 +0000 (UTC)
zzapper <david@xxxxxxxxxxxxxx> wrote:
> bindkey -M viins '^O' copy-prev-shell-word
>
> cp fred.php old_<Control-O>
>
> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author