From: zzapper <zsh@rayninfo.co.uk>
To: Zsh-Users List <zsh-users@zsh.org>
Subject: How to see history 'expression' in history rather than the expansion?
Date: Sun, 12 Jun 2022 14:17:32 +0100 [thread overview]
Message-ID: <bab2e230-6e63-2bac-ae72-0a2ee43634c7@rayninfo.co.uk> (raw)
Hi
ls IMG_20220612_093815.jpg
cp !$ /tmp
# but when I look at history I obviously see
ls IMG_20220612_093815.jpg
cp IMG_20220612_093815.jpg /tmp
# In this case !$ is trivial but sometimes I do an arbitrarily more
complex history recall e.g.
cp !?imgxyz?$ /tmp
and I'd like to see that expression in my history (for reference
purposes or to refine and correct it)
###### I've just remembered/realised that the following widget solves
that. #####
###### But will still post this just to get any possible further advice
#####
commit-to-history() {
# store a command in history for reuse w/o executing it
print -s ${(z)BUFFER}
zle send-break
}
zle -N commit-to-history
bindkey "^h" commit-to-history # ctrl-h
zzapper
next reply other threads:[~2022-06-12 13:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-12 13:17 zzapper [this message]
2022-06-12 16:16 ` Bart Schaefer
2022-06-13 10:33 ` Pier Paolo Grassi
2022-06-13 10:43 ` Peter Stephenson
2022-06-13 16:02 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bab2e230-6e63-2bac-ae72-0a2ee43634c7@rayninfo.co.uk \
--to=zsh@rayninfo.co.uk \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).