zsh-users
 help / color / mirror / code / Atom feed
* How to see history 'expression' in history rather than the expansion?
@ 2022-06-12 13:17 zzapper
  2022-06-12 16:16 ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: zzapper @ 2022-06-12 13:17 UTC (permalink / raw)
  To: Zsh-Users List

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-13 16:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-12 13:17 How to see history 'expression' in history rather than the expansion? zzapper
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

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).