Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: !$ changes when mistyped?
- X-seq: zsh-users 15428
- From: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: !$ changes when mistyped?
- Date: Thu, 23 Sep 2010 22:18:14 -0400 (EDT)
- Cc: Zsh Users <zsh-users@xxxxxxx>
- In-reply-to: <100923190658.ZM3356@xxxxxxxxxxxxxxxxxxxxxx>
- 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: <alpine.LNX.2.01.1009231557130.4754@hp> <100923190658.ZM3356@xxxxxxxxxxxxxxxxxxxxxx>
On Thu, 23 Sep 2010, Bart Schaefer wrote:
On Sep 23, 4:22pm, Benjamin R. Haskell wrote:
}
} Is this behavior expected -- should history expansion/completion }
(terminology?) change what '!$' references? If so, is it
configurable?
Quoth the documentation:
--- 8< ---
By default, a history reference with no event designator refers to the
same event as any preceding history reference on that command line; if
it is the only history reference in a command, it refers to the
previous command. However, if the option CSH_JUNKIE_HISTORY is set,
then every history reference with no event specification _always_
refers to the previous command.
For example, `!' is the event designator for the previous command, so
`!!:1' always refers to the first word of the previous command, and
`!!$' always refers to the last word of the previous command. With
CSH_JUNKIE_HISTORY set, then `!:1' and `!$' function in the same
manner as `!!:1' and `!!$', respectively. Conversely, if
CSH_JUNKIE_HISTORY is unset, then `!:1' and `!$' refer to the first
and last words, respectively, of the same event referenced by the
nearest other history reference preceding them on the current command
line, or to the previous command if there is no preceding reference.
--- 8< ---
What the doc doesn't say, but which is true, is that history
references expanded by magic-space or completion are considered "the
nearest other history reference preceding" for this purpose.
Hence you probably want CSH_JUNKIE_HISTORY.
Awesome. Yes, this appears to be exactly what I was looking for.
--
Thanks,
Ben
Messages sorted by:
Reverse Date,
Date,
Thread,
Author