Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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)
share|improve this answer
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).

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.