From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-users@zsh.org
Subject: Re: copy "real" previous word
Date: Mon, 31 Mar 2014 15:47:48 +0100 [thread overview]
Message-ID: <20140331154748.1dc7cf27@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <XnsA3019D93A244Edavidrayninfocouk@80.91.229.13>
On Mon, 31 Mar 2014 14:29:25 +0000 (UTC)
zzapper <david@rayninfo.co.uk> 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
next prev parent reply other threads:[~2014-03-31 14:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-31 14:29 zzapper
2014-03-31 14:47 ` Peter Stephenson [this message]
2014-03-31 15:11 ` zzapper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140331154748.1dc7cf27@pwslap01u.europe.root.pri \
--to=p.stephenson@samsung.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).