Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
tweaking insert-last-word behavior
- X-seq: zsh-users 14536
- From: Andy <andy@xxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: tweaking insert-last-word behavior
- Date: Mon, 9 Nov 2009 00:11:17 -0500 (EST)
- 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
- Reply-to: Andy Sisson <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?
Thanks,
Andy
Messages sorted by:
Reverse Date,
Date,
Thread,
Author