0

Like many others, I use panels extensively in Sublime Text 2 (View->Layout->etc).

I'd like to map a shortcut to close all tabs in the active panel.
I know the close_alland close_others commands exist as documented in the following SO questions:

However, I haven't been able to find a command to close just the tabs in the active pane.
Is there a way to do this?

Community
  • 1
  • 1
tohster
  • 6,973
  • 5
  • 38
  • 55

1 Answers1

2

Make a file in your Packages/User directory named closetabsinpane.py with these contents:

import sublime
import sublime_plugin

class CloseViewsInGroupCommand(sublime_plugin.WindowCommand):
    def run(self):
        for v in self.window.views_in_group(self.window.active_group()):
            g, view_index = self.window.get_view_index(v)
            self.window.run_command("close_by_index", { "group": g, "index": view_index})

And add a shortcut to your user keymap file:

{ "keys": ["ctrl+shift+alt+x"], "command": "close_views_in_group" },
Sergey Telshevsky
  • 12,077
  • 6
  • 55
  • 78