Add only/co command

This commit is contained in:
Florian Bruhin 2014-05-09 11:24:33 +02:00
parent 8fc12fea5f
commit e6af8bb7ae
3 changed files with 9 additions and 3 deletions

3
TODO
View File

@ -284,9 +284,6 @@ Open quickmark in a new tab (command tab_quickmark, aliases: tabqmarks).
tab-handling
------------
co
Close all tabs except for the current one (command only).
[n]T
Focus nth tab, first tab if n is omitted or last tab if n is 0. (command focus_tab, aliases: tab).

View File

@ -547,6 +547,7 @@ DATA = OrderedDict([
('gO', 'tabopencur'),
('ga', 'tabopen about:blank'),
('d', 'tabclose'),
('co', 'only'),
('J', 'tabnext'),
('K', 'tabprev'),
('r', 'reload'),

View File

@ -248,6 +248,14 @@ class TabbedBrowser(TabWidget):
elif last_close == 'blank':
tab.openurl('about:blank')
@cmdutils.register(instance='mainwindow.tabs')
def only(self):
"""Close all tabs except for the current one."""
for i in range(self.count() - 1):
if i == self.currentIndex():
continue
self._close_tab(self.widget(i))
@cmdutils.register(instance='mainwindow.tabs', split=False, name='tabopen')
def tabopen_cmd(self, url):
"""Open a new tab with a given url."""