Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
How to see history 'expression' in history rather than the expansion?
- X-seq: zsh-users 27843
- From: zzapper <zsh@xxxxxxxxxxxxxx>
- To: Zsh-Users List <zsh-users@xxxxxxx>
- Subject: How to see history 'expression' in history rather than the expansion?
- Date: Sun, 12 Jun 2022 14:17:32 +0100
- Archived-at: <https://zsh.org/users/27843>
- List-id: <zsh-users.zsh.org>
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author