Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: tweaking insert-last-word behavior
- X-seq: zsh-users 14538
- From: Wayne Davison <4wayned@xxxxxxxxx>
- To: Andy Sisson <andy@xxxxxxxxxxx>
- Subject: Re: tweaking insert-last-word behavior
- Date: Mon, 9 Nov 2009 08:45:01 -0800
- 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=IG4km+J17JLC0GitvWGI3IiVcn1OCuWFdgULD8Pn+pA=; b=E6MSGID4OlDPT4nXvX6y/lC5seebVtAxl+UO93+tHqGLL5txXt/afHJiUWUf2A+aMy oNPhzs7Jhyc5Ya0i4C2nBVPhHD7rBk8bAjk7TN3tKb7peJObNfx+QSbopz2FBY/KJimO kY6T5d0cqkuqbvKX0HpNlMqUF5DG9dC9Rzv4E=
- 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=uDo77ocNYfEAd1BYmio257YUVMBSg3ox9JthJKdS9yIhbd8XxugU0/RO847fcdf3Tm U51dSH6kBQ9IdDsgyzQIzvB8CnrN1Z+YC8tqOXNm3t830UHX6Ou5f0EeRLJ+F9fymW2T GqbkqchO+R2PuzIr2EgVlNYdv9zcVfI2NrOYQ=
- 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>
On Sun, Nov 8, 2009 at 9:11 PM, Andy <andy@xxxxxxxxxxx> wrote:
> 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 use smart-insert-last-word with a match directive:
autoload -U smart-insert-last-word
zle -N insert-last-word smart-insert-last-word
zstyle :insert-last-word match '[^,]??*'
Since I want words that are at least 3 letters long and don't begin with a
comma (all my global aliases use a leading comma, such as ",l" for "| less",
",f" for "| fgrep", etc.). Since anything really short is not really worth
using insert-last-word for anyway, this tends to do what I expect. Note
that if no qualifying words are found on a line, smart-insert-last-word just
returns the last word, so don't let that fool you into thinking there is a
bug when there is not.
..wayne..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author