Technically the previous answer was correct, the location is wrong:
- Open DefaultInput.ini
- At the top, locate the section: [/Script/Engine.PlayerInput]
- Add the following line under all the “+DebugExecBindings” (There should be around four):
-DebugExecBindings=(Key=Escape,Command=“CloseEditorViewport”)
*Notice that the other four bindings have a “+” sign, while this “-” unbinds the original Esc key setting