diff --git a/Context.sublime-menu b/Context.sublime-menu old mode 100755 new mode 100644 index ba037db..46da741 --- a/Context.sublime-menu +++ b/Context.sublime-menu @@ -9,6 +9,11 @@ "command": "close_other_tabs", "caption": "Close Other Tabs" }, + { + "id": "CloseTabsToTheRight", + "command": "close_tabs_to_the_right", + "caption": "Close Tabs to the Right" + }, ] diff --git a/Default (Linux).sublime-keymap b/Default (Linux).sublime-keymap old mode 100755 new mode 100644 index 8f3010d..0805757 --- a/Default (Linux).sublime-keymap +++ b/Default (Linux).sublime-keymap @@ -4,6 +4,9 @@ }, { "keys": ["ctrl+super+w"], "command": "close_other_tabs" + }, + { + "keys": ["ctrl+super+r"], "command": "close_tabs_to_the_right" } ] diff --git a/Default (OSX).sublime-keymap b/Default (OSX).sublime-keymap old mode 100755 new mode 100644 index 8f3010d..505e21f --- a/Default (OSX).sublime-keymap +++ b/Default (OSX).sublime-keymap @@ -4,6 +4,10 @@ }, { "keys": ["ctrl+super+w"], "command": "close_other_tabs" + }, + { + "keys": ["ctrl+super+r"], "command": "close_tabs_to_the_right" } + ] diff --git a/Default (Windows).sublime-keymap b/Default (Windows).sublime-keymap old mode 100755 new mode 100644 index 8f3010d..505e21f --- a/Default (Windows).sublime-keymap +++ b/Default (Windows).sublime-keymap @@ -4,6 +4,10 @@ }, { "keys": ["ctrl+super+w"], "command": "close_other_tabs" + }, + { + "keys": ["ctrl+super+r"], "command": "close_tabs_to_the_right" } + ] diff --git a/Default.sublime-commands b/Default.sublime-commands old mode 100755 new mode 100644 index a58a038..146fe38 --- a/Default.sublime-commands +++ b/Default.sublime-commands @@ -6,5 +6,9 @@ { "caption": "Close Other Tabs: Close all tabs except the active one", "command": "close_other_tabs" + }, + { + "caption": "Close Tabs to the Right: Close all tabs to the right of the active one", + "command": "close_tabs_to_the_right" } -] +] diff --git a/Main.sublime-menu b/Main.sublime-menu old mode 100755 new mode 100644 index c5c7d1a..1b4b148 --- a/Main.sublime-menu +++ b/Main.sublime-menu @@ -16,7 +16,12 @@ "mnemonic": "", "id": "close_other_tabs", "command":"close_other_tabs" - } + }, { + "caption": "Close Tabs to the Right", + "mnemonic": "", + "id": "close_tabs_to_the_right", + "command":"close_tabs_to_the_right" + } ] } ] diff --git a/README.md b/README.md old mode 100755 new mode 100644 index 961fe26..6c86613 --- a/README.md +++ b/README.md @@ -3,11 +3,12 @@ CloseOtherWindows-Sublime-PLugin what it does ------------ -it provides 2 commands: +it provides 3 commands: - Close all windows except current window. - Close all tabs except current tab -(you could achieve the same by right-clicking on a tab and choose 'close other tabs') +- Close all tabs to the right of the current tab +(you could achieve the same by right-clicking on a tab and choose 'Close Other Tabs' or 'Close Tabs to the Right') this package gives you a keyboard shortcut for that (btw, the same as on TextMate) Key and menu options @@ -20,6 +21,11 @@ Key and menu options - Right click and select Close Other Tabs - Press `Ctrl`+`Super`+`w` +- Click File menu option and select Close Tabs to the Right +- Right click and select Close Tabs to the Right +- Press `Ctrl`+`Super`+`r` + + How to download ----------------- diff --git a/close_others.py b/close_others.py index 14abff8..0ef2c31 100644 --- a/close_others.py +++ b/close_others.py @@ -13,10 +13,17 @@ def run(self): for i,w in enumerate(allWindows): if currentWindow != w: w.run_command('close_window') - + + class closeOtherTabsCommand(sublime_plugin.TextCommand): def run(self, edit): window = self.view.window() group_index, view_index = window.get_view_index(self.view) - window.run_command("close_others_by_index", { "group": group_index, "index": view_index}) + window.run_command("close_others_by_index", {"group": group_index, "index": view_index}) + +class closeTabsToTheRightCommand(sublime_plugin.TextCommand): + def run(self, edit): + window = self.view.window() + group_index, view_index = window.get_view_index(self.view) + window.run_command("close_to_right_by_index", {"group": group_index, "index": view_index})