Skip to content

Instantly share code, notes, and snippets.

@smockle
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smockle/c7fde7783ba2841257f5 to your computer and use it in GitHub Desktop.
Save smockle/c7fde7783ba2841257f5 to your computer and use it in GitHub Desktop.
Close inactive tabs using Option-Command-w in Atom Editor
# Add the lines below to your init script,
# accessible via Atom > Open Your Init Script
atom.commands.add 'atom-workspace', 'tabs:force-close-other-tabs', ->
tabBar = atom.workspace.getPanes()[0]
tabBarElement = atom.views.getView(tabBar).querySelector(".tab-bar")
tabBarElement.querySelector(".active").classList.add("right-clicked")
atom.commands.dispatch(tabBarElement, 'tabs:close-other-tabs')
# Add the lines below to your keymap,
# accessible via Atom > Open Your Keymap
'atom-workspace':
'alt-cmd-w': 'tabs:force-close-other-tabs'
@smockle
Copy link
Author

smockle commented Apr 1, 2015

By using atom-workspace instead of atom-text-editor, the command will run if (e.g.) the Find in Project pane or the Settings pane is active.

@smockle
Copy link
Author

smockle commented Apr 21, 2015

Now an Atom Editor package: https://atom.io/packages/close-other-tabs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment