Prevent cmd-w from closing a pane?


Does anybody know if there’s a way to prevent the cmd+w keybinding from closing a pane when no tabs are open?

I like to configure my editor with two panes side-by-side and keep it that way. It’s frustrating when an extra cmd+w accidentally closes the pane and I have to configure it again. Not the end of the world, but just annoying.



You could map Cmd+W to a different command that only closes tabs instead of panes. By default it is mapped to core:close. You can check out the the-closer package to see one approach to changing the behavior of core:close.


I’m new to Atom, but I think you just want to uncheck ‘Destroy Empty Panes’ option on the main settings screen:


Hehe … oh yeah, there’s that too :blush:


Thanks for the suggestion. I do have that unchecked, but that only prevents the pane from being destroyed when the last file is closed. If you hit cmd+w again, it still closes the pane.

@leedohm thanks for the suggestion on remapping cmd+w but I have not been able to do that successfully yet. Mainly because I haven’t taken time to write a command :slight_smile:

1 Like

I unchecked the “Destroy Empty Panes” setting that @pascalpp mentioned and then added this to my

atom.commands.add 'atom-workspace',
  'custom:close': ->

and then mapped Cmd+W to custom:close instead of core:close. That seems to have done it. Let me know if it works for you.


To be honest, I would expect “Destroy Empty Panes” to also not destroy on cmd+w (or ctrl+w on linux). To me this kind of feels like a user experience bug. If I close the tab - however I decide to do that - the pane should stay open.

Thanks for the hack solution @leedohm, but would this qualify as something to report as a bug fix?