I'm looking for a text editor that can close the current file when you press ESC key.

I am interested about this for using with a file manager, I open for edit a file and with ESC I want to return to the file commander.

I tried to override the close window command on XCode but it didn't work, instead of closing the window it does write me an upside down question mark!?

In addition, I tried to assign ESC as shortcut key in System Preferences, but this is not allowed.


Emacs allows you to override shortcuts keys.

Add this line to your .emacs file (located in your home directory) :

(global-set-key (kbd "<escape>") 'save-buffers-kill-emacs)
  • Thanks, this works, but only with Emacs. Maybe I will try to learn how to use emacs ;) – sorin Mar 17 '11 at 12:14

Any word processor can be made to close its front window when you hit escape. Write a little AppleScript, like this:

tell application "BBEdit" -- change this to the WP you want
        close front window
    end try
end tell

Get a copy of 'FastScripts' script menu replacement, and put your script in Library/Scripts/Applications/BBEdit folder. Assign the escape key to the script (in FastScripts preferences).

  • It at my script! – Wayfaring Stranger Mar 17 '11 at 18:35
  • --tell application "BBEdit" --try --close front window --end try --end tell --return – Wayfaring Stranger Mar 17 '11 at 18:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .