I am using the following line in tmux for getting a “hardcopy” feature like in GNU Screen:
bind H capture-pane ; save-buffer -b 0 ~/tmux.hardcopy ; delete-buffer -b 0
However, the ANSI colors are not captured to the file. How do I make tmux save the ANSI escape sequences so that the hardcopy will be colored too?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
tmux 1.8 added the -e option to capture-pane; using this new option causes the captured data to include the effective escape sequences.
bind H capture-pane -e ; save-buffer ~/tmux.hardcopy ; delete-buffer
(You can omit -b 0 since buffer 0 is the default buffer if one is not specified.)
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0