From da6d12a657a3d295827eca685ceea714b908b6b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20Wi=C3=9Fmann?= Date: Tue, 11 Aug 2015 10:13:00 +0200 Subject: [PATCH 1/3] Make tab-focus (bound to gt) behave as in VIM If no count or index is given, tab-focus switches to the next tab (using tab-next internally). So the keychain gt behaves as gt in vim: - gt focuses the next tab - 1gt focuses the first tab - gt (e.g. 5gt) focuses the n'th (e.g. fith) tab --- qutebrowser/browser/commands.py | 4 ++++ qutebrowser/config/configdata.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 5a07dbb56..08296ae02 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -882,10 +882,14 @@ class CommandDispatcher: index: The tab index to focus, starting with 1. The special value `last` focuses the last focused tab. count: The tab index to focus, starting with 1. + If neither count nor index are given, it behaves like tab-next """ if index == 'last': self._tab_focus_last() return + if index is None and count is None: + self.tab_next() + return try: idx = cmdutils.arg_or_count(index, count, default=1, countzero=self._count()) diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 7a1f4f236..5e40bf7e1 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -1236,7 +1236,7 @@ KEY_DATA = collections.OrderedDict([ ('tab-move', ['gm']), ('tab-move -', ['gl']), ('tab-move +', ['gr']), - ('tab-next', ['J', 'gt']), + ('tab-focus', ['J', 'gt']), ('tab-prev', ['K', 'gT']), ('tab-clone', ['gC']), ('reload', ['r']), From 44f8cf4b1a50be28d46e00890a5fba411efb51d9 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Aug 2015 22:01:18 +0200 Subject: [PATCH 2/3] Move :tab-focus documentation. --- qutebrowser/browser/commands.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 08296ae02..1fc2a5bf7 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -878,11 +878,12 @@ class CommandDispatcher: def tab_focus(self, index: {'type': (int, 'last')}=None, count=None): """Select the tab given as argument/[count]. + If neither count nor index are given, it behaves like tab-next. + Args: index: The tab index to focus, starting with 1. The special value `last` focuses the last focused tab. count: The tab index to focus, starting with 1. - If neither count nor index are given, it behaves like tab-next """ if index == 'last': self._tab_focus_last() From 637325fc76946caec2f8984fdae6c30d8672b301 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 11 Aug 2015 22:01:26 +0200 Subject: [PATCH 3/3] Regenerate docs. --- README.asciidoc | 2 +- doc/help/commands.asciidoc | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.asciidoc b/README.asciidoc index 4b072684c..2ee5a9402 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -158,6 +158,7 @@ Contributors, sorted by the number of commits in descending order: * sbinix * Tobias Patzl * Johannes Altmanninger +* Thorsten Wißmann * Samir Benmendil * Regina Hug * Mathias Fussenegger @@ -167,7 +168,6 @@ Contributors, sorted by the number of commits in descending order: * zwarag * error800 * Tim Harder -* Thorsten Wißmann * Thiago Barroso Perrotta * Matthias Lisin * Helen Sherwood-Taylor diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index a898b9698..012522909 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -630,6 +630,8 @@ Syntax: +:tab-focus ['index']+ Select the tab given as argument/[count]. +If neither count nor index are given, it behaves like tab-next. + ==== positional arguments * +'index'+: The tab index to focus, starting with 1. The special value `last` focuses the last focused tab.