Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: I broke my !$
- X-seq: zsh-users 16466
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: I broke my !$
- Date: Wed, 05 Oct 2011 09:13:20 -0700
- In-reply-to: <CA+mcLN568U6RsoWrQ=CL1RLRh=OoXHcO_SCjdYH=C6134wO-FQ@mail.gmail.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>
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