Avoid Accidentally Clearing Text From An iTerm2 Window

Every now and then I'd hit a key combination in iTerm2 that would clear the text off the screen. It was still there. It would just be mostly invisible. I couldn't figure out what I did or how to get it back.

The issue was accidentally hitting CTRLk. The solution I'm using is to tell iTerm2 to ignore that key combo. This is done in the preference under the "Keys" section in the "Key Bindings" tab.

Click the plus to the left of "Presets..." which opens the dialog where you can set the key.

I didn't run into that issue often, but it was jarring when I did. Especially on stream. Now, I don't have to worry about it.


With tmux on OSX, how can I make command+k clear more gracefully -- Answer

This is the post that got me to the solution. It suggests remapping to a different clear command.


Note on redrawing tmux

This answer mentions you can use LEADERr to redraw the screen in tmux. (Where LEADER is CTRLb by default)