Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add "Close Tabs to the Right" #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Context.sublime-menu
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},


]
3 changes: 3 additions & 0 deletions Default (Linux).sublime-keymap
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
},
{
"keys": ["ctrl+super+w"], "command": "close_other_tabs"
},
{
"keys": ["ctrl+super+r"], "command": "close_tabs_to_the_right"
}

]
4 changes: 4 additions & 0 deletions Default (OSX).sublime-keymap
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
},
{
"keys": ["ctrl+super+w"], "command": "close_other_tabs"
},
{
"keys": ["ctrl+super+r"], "command": "close_tabs_to_the_right"
}


]
4 changes: 4 additions & 0 deletions Default (Windows).sublime-keymap
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
},
{
"keys": ["ctrl+super+w"], "command": "close_other_tabs"
},
{
"keys": ["ctrl+super+r"], "command": "close_tabs_to_the_right"
}


]
6 changes: 5 additions & 1 deletion Default.sublime-commands
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
]
7 changes: 6 additions & 1 deletion Main.sublime-menu
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
]
10 changes: 8 additions & 2 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
-----------------

Expand Down
11 changes: 9 additions & 2 deletions close_others.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})