Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: tweaking insert-last-word behavior
- X-seq: zsh-users 14537
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Andy Sisson <andy@xxxxxxxxxxx>
- Subject: Re: tweaking insert-last-word behavior
- Date: Mon, 9 Nov 2009 14:11:05 +0100
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=mW5jOF5Nh8Yl7H/Mf/KnGWH0q9TZaJfFNNQGE9fwrLE=; b=nHm1rIES6q+nZTha0bwV7/nRwGbnqo0+7TegrjUh4yyXB3oFmFHWfT/MylUaEry1th 5SqUJlprK4zL64K6CHAIOVfOg/JNi7H9EBv95O90BdIz8b1Or3YWenoF2RMOFzPLHB+f 0RG6SNtT4adeWywPckG28LlJuYaSrOVba0saw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=ryEAwoCO+uKr7LvgYOT9f5B82lWxEos6NLz/cCxfE8ITPhralgueRAwRgZxH9eogNw +YKwXVmXmjItCBO4qL/bkWtwxg2fih6+Wr611UM1hu7W0AkirxZ+qiGQ3C0bgA+6U6OM uIKND7bvjdmqNQ29CWX79QEWkzymiqoaOtnwA=
- In-reply-to: <Pine.LNX.4.64.0911082355440.1618@xxxxxxxxxxx>
- 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
- References: <Pine.LNX.4.64.0911082355440.1618@xxxxxxxxxxx>
2009/11/9 Andy <andy@xxxxxxxxxxx>:
> Hi -
>
> Is there some way to induce selective amnesia in 'insert-last-word'?
>
> Specifically, I get a lot of use out of aliases like
> alias -g M='| more'
>
> However, if my previous command was
> % grep bar foo.txt M
> and I'm now breathlessly typing out my next clever interrogation of foo.txt,
> the letter "M" is never, of course, what I actually mean to insert when I
> hit 'ESC-.'
>
> I suspect that many shell users make this mistake at least occasionally when
> a pager is invoked at the end of a command - regardless of whether it's
> aliased.
>
> Ideally I'd love to hear that there's an undocumented 'alias' flag that
> means "invisible to insert-last-word". I presume that'd be a lousy general
> solution to the issue, however.
>
> I assume I could remap it so it compares !$ against a list of strings like
> 'M' and alternately inserts word n-1. Beyond that feeling rather kludgy, I'm
> not quite sure how to do that; it wasn't obvious to me, for instance, how
> one references the word at !(n-1) with zsh.
>
> Maybe I'm thinking about the problem in the wrong way. Is there an easy
> solution?
I have copy-earlier-word bound to the key to the left of insert-last-word, which
lets me select any word of any previous line quite easily.
autoload -U copy-earlier-word
zle -N copy-earlier-word
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author