Home Download Buy Blog Forum Support

How do I bind "close other tabs" to a hotkey?

How do I bind "close other tabs" to a hotkey?

Postby xeno.by on Tue Feb 07, 2012 11:25 am

close_others_by_index that is used by tab context menus failed to work for me, so I fell back to enumerating the views, activating and closing them one by one. Is there a civilized solution to this problem?
xeno.by
 
Posts: 106
Joined: Mon Jan 30, 2012 10:03 am
Location: Lausanne, Switzerland

Re: How do I bind "close other tabs" to a hotkey?

Postby neilsarkar on Tue Apr 24, 2012 1:45 pm

I just wrote a quick plugin to do this.

# $sublime_root/Packages/User/close_other_tabs.py

import sublime, sublime_plugin

class CloseOtherTabs(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})

# keybindings
...
{
"keys": ["super+alt+w"],
"command": "close_other_tabs"
}
neilsarkar
 
Posts: 2
Joined: Mon Apr 23, 2012 1:12 pm


Return to General Discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 20 guests