How to disable closing of a window on Esc?

I use an escape key often to close autocomplete popups, etc. and it's quite inconvenient when i'm doing changes in diff window and esc closes it and i have to reopen it on a needed file. Is there a preference to turn that off completely?

Upd: And as a result of the question another question arises: how to reopen the last closed window?

Please sign in to leave a comment.