Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: I broke my !$
- X-seq: zsh-users 16549
- From: Jay Levitt <jay.levitt@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: I broke my !$
- Date: Mon, 31 Oct 2011 12:26:35 -0400
- Cc: zsh-users@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=gBdlB8LcA35WdbZqk7lLGf7558MoYfQbWGSC3I7nLSE=; b=dEso2MSGSovNofudloMHamCiOV61Kv+M9ehmAY9h7eV8DzZ4H1i5KN6xWfyDmjDdNE 998nchquRPJuzF/oMNM8GOecLyfvf12b7hp3O0MnW8yFr49INQHsLmvYFazh4aplEKg8 a9f5FS9TnQYz5P9Izxk0TFvlrYyviAmrr5Ufw=
- In-reply-to: <111005091320.ZM3857@torch.brasslantern.com>
- 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: <CANSg5mpWGJvBJODuECM1PzcSp0rdw19AdOMpBzxZ8fZZhh-Ykw@mail.gmail.com> <20111005121950.GA20868@daniel3.local> <CA+mcLN568U6RsoWrQ=CL1RLRh=OoXHcO_SCjdYH=C6134wO-FQ@mail.gmail.com> <111005091320.ZM3857@torch.brasslantern.com>
Picking this up... Yes, I modified zsh_add_history hook; see
thediscussion under "zshaddhistory confusion". So what I have now
isthis:
function zshaddhistory() { print -sr -- "${1%%$'\n'}" fc -p
~/.zsh_history_detail print -sr -- "${1%%$'\n'} ### ${PWD} $(date
'+%Y-%m-%d %R')" return 1}
which seems to support the "you need print -S" theory. I have
4.3.12,but it doesn't have -S; is that something only on trunk right
now? Istrunk stable enough for average daily use?
I'm on zsh 4.3.12.
On Wed, Oct 5, 2011 at 12:13 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Oct 5, 5:48pm, Julien Nicoulaud wrote:
> }
> } Same for me, messing with zsh_add_history hook breaks history expansion:
>
> Aha.
>
> } history_strip_passwords() {
> } # Strip out -Dgpg.passphrase option value (Maven)
> } print -sr "${${1%%$'\n'}//(#b)(gpg.passphrase=)*[:space:]/$match[1]}"
> } fc -p
> } }
> } add-zsh-hook zshaddhistory history_strip_passwords
> }
> } With this hook, history exapnsions like "!$" or "!!" always return the whole
> } history line...
>
> You need to either remove the double quotes or use "print -S". With the
> quotes and the lower-case -s you are making a history entry that has
> exactly one word consisting of the entire command.
>
> -s
> Place the results in the history list instead of on the
> standard output. Each argument to the print command is
> treated as a single word in the history, regardless of its
> content.
>
> -S
> Place the results in the history list instead of on the
> standard output. In this case only a single argument is
> allowed; it will be split into words as if it were a full
> shell command line. The effect is similar to reading the
> line from a history file with the HIST_LEX_WORDS option
> active.
>
> It's possible that you have a version of zsh that has the history hook
> but not the -S option of print. In that event you probably also have a
> buggy ${(z)...} so there's no immediate workaround that comes to mind.
> Something involving writing it to a different history file and then
> reading back with "fc -R" might work.
>
Messages sorted by:
Reverse Date,
Date,
Thread,
Author