ls /foo/bar/this_is_the_file.txt
cat "esc + ."
which expands to
cat /foo/bar/this_is_the_file.txt
ls /foo/bar/this_is_the_file.txt
cat "esc + ."
which expands to
cat /foo/bar/this_is_the_file.txt
Another no-brainer imho is editing you /etc/inputrc or your $HOME/.inputrc and bind keys (usually PgUp and PgDn) to history-search-backward and history-search-forward.
From there you can navigate your history like with the arrows, but it will only consider lines that starts with the string that is currently on the command line.
It is a MUST.
Try this: https://lorenzo.mile.si/macos-iterm2-use-linux-keyboard-shor...
edit: I'm dumb, that was for iTerm, I got it working!
do you type the literal characters "esc + ." or do you press CTRL+[ then period, or do you push the escape key, then period, or do you push escape and period at the same time?
I'm not at a terminal to try any of this and find out for myself.
But pressing and releasing ESC and then pressing and releasing period works excellently. Thank you.