Atom editor: beware shift-cmd-W


Note: Content might be outdated!

Ever lost an unsaved file in Atom editor, because you accidentally pressed shift-cmd-W (close window without confirmation) instead of shift-alt-W (wrap selection in tag)?

Atom can restore a session when you close a previously saved file with unsaved edits, but it won’t (as far as my knowledge and agonizing experience go) restore a file that has not been saved before.

Solution: Add a custom keybinding to redefine the shift-cmd-W command.

  1. Atom→Keymap… to open keymap.cson.
  2. Add the following and save the file:
  'shift-cmd-W': 'core:close'

This basically duplicates the behavior of cmd-W for shift-cmd-W. Atom will nicely ask for confirmation before closing the file and sending your edits to Walhalla.

I use Atom to edit/write plain old HTML a lot, and I have no use for a command that would delete unsaved content without confirmation, so this works for me.

Should have done this way earlier.

Animated GIF of the process described above.