Or there any other way to do it?
Googling brings up nothing ( I tried for years ).
If you don't what iterm2 means by "instant replay":
- basically like desktop video capturing, only in text - so the user can copy-paste from the captured history
An example for clarification:
I edit a file in vim ; close vim ; accidentally delete the file ; I start "instant replay" and find what the terminal emulator looked like when I was editing the file.
I don't know of a terminal emulator that has this built in. But following the Unix philosophy, let the terminal emulator do the terminal emulator, and use a separate tool to do the recording and replay. You can use script to record the output as streams, or ttyrec to record timings as well (the Wikipedia page links to several players for recordings with various degrees of sophistication, including IPBT which is good for finding things that were only displayed for a very short time). There are fewer tools that record the input; one such is ttyrec2.
You might find that https://asciinema.org/ is a more useful option than script as it records the session as a terminal window rather than a raw stream of characters that comprise the terminal session.
It doesn't appear to have the replay option you're seeking, but it does allow you to replay the session in another window, pause it at the critical moment, and copy'n'paste from that recording back to the original terminal.
mlterm( sourceforge.net/projects/mlterm ) offers the ability to have history be recorded in
ttyrecformat which does allow you to play-back sessions with copy/paste intact.