In ZSH prompt expansion, the command %E is supposed to “Clear to end of line.”
However, it does not work in tmux:

The issue seems to be with BCE (Background Color Erase). In screen, I can add the option defbce on. I can’t find any similar setting for tmux. Does it exist?
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
Unlike screen, tmux does not have switchable background colour erase capability in its terminal emulator. Erasure is always with the default background colour, never the current background colour.
Nicholas Marriott added it to the to-do list in September 2015, but stated at the time that neither he nor anyone else cares enough about it to implement it.
He later implemented it in October 2016, nearly a year after this answer was originally written.
Further reading
- Nicholas Marriott (2015-09-15). Support background color erase (bce). tmux/tmux. Bug #109. GitHub.
- Nicholas Marriott (2015-09-15). Add BCE to TODO.. tmux/tmux. 54bd7612868341c47bd3bd237c9598d5860b3ef3. GitHub.
- vim colorscheme completely wrong inside screen or tmux sessions:
t_ut turns off BCE. tmux should support BCE but it depends on the tmux version, I think 2.1 is too old.
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
