mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 10:41:58 +02:00
@@ -331,6 +331,11 @@ class Boss:
|
|||||||
if text:
|
if text:
|
||||||
set_primary_selection(text)
|
set_primary_selection(text)
|
||||||
|
|
||||||
|
def goto_tab(self, tab_num):
|
||||||
|
tm = self.active_tab_manager
|
||||||
|
if tm is not None:
|
||||||
|
tm.goto_tab(tab_num - 1)
|
||||||
|
|
||||||
def next_tab(self):
|
def next_tab(self):
|
||||||
tm = self.active_tab_manager
|
tm = self.active_tab_manager
|
||||||
if tm is not None:
|
if tm is not None:
|
||||||
|
|||||||
@@ -109,6 +109,8 @@ def parse_key_action(action):
|
|||||||
args = tuple(map(parse_key_action, filter(None, parts)))
|
args = tuple(map(parse_key_action, filter(None, parts)))
|
||||||
elif func == 'send_text':
|
elif func == 'send_text':
|
||||||
args = rest.split(' ', 1)
|
args = rest.split(' ', 1)
|
||||||
|
elif func == 'goto_tab':
|
||||||
|
args = (max(0, int(rest)),)
|
||||||
elif func in shlex_actions:
|
elif func in shlex_actions:
|
||||||
args = shlex.split(rest)
|
args = shlex.split(rest)
|
||||||
return KeyAction(func, args)
|
return KeyAction(func, args)
|
||||||
@@ -338,7 +340,7 @@ with open(
|
|||||||
defaults = parse_config(f.readlines(), check_keys=False)
|
defaults = parse_config(f.readlines(), check_keys=False)
|
||||||
Options = namedtuple('Defaults', ','.join(defaults.keys()))
|
Options = namedtuple('Defaults', ','.join(defaults.keys()))
|
||||||
defaults = Options(**defaults)
|
defaults = Options(**defaults)
|
||||||
actions = frozenset(a.func for a in defaults.keymap.values()) | frozenset({'combine', 'send_text'})
|
actions = frozenset(a.func for a in defaults.keymap.values()) | frozenset({'combine', 'send_text', 'goto_tab'})
|
||||||
no_op_actions = frozenset({'noop', 'no-op', 'no_op'})
|
no_op_actions = frozenset({'noop', 'no-op', 'no_op'})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -294,6 +294,10 @@ map ctrl+shift+q close_tab
|
|||||||
map ctrl+shift+l next_layout
|
map ctrl+shift+l next_layout
|
||||||
map ctrl+shift+. move_tab_forward
|
map ctrl+shift+. move_tab_forward
|
||||||
map ctrl+shift+, move_tab_backward
|
map ctrl+shift+, move_tab_backward
|
||||||
|
# You can also create shortcuts to go to specific tabs, with 1 being the first tab
|
||||||
|
# map ctrl+alt+1 goto_tab 1
|
||||||
|
# map ctrl+alt+2 goto_tab 2
|
||||||
|
|
||||||
# Just as with new_window above, you can also pass the name of arbitrary
|
# Just as with new_window above, you can also pass the name of arbitrary
|
||||||
# commands to run when using new_tab.
|
# commands to run when using new_tab.
|
||||||
|
|
||||||
|
|||||||
@@ -360,6 +360,10 @@ class TabManager: # {{{
|
|||||||
if len(self.tabs) > 1:
|
if len(self.tabs) > 1:
|
||||||
self.set_active_tab((self.active_tab_idx + len(self.tabs) + delta) % len(self.tabs))
|
self.set_active_tab((self.active_tab_idx + len(self.tabs) + delta) % len(self.tabs))
|
||||||
|
|
||||||
|
def goto_tab(self, tab_num):
|
||||||
|
if tab_num < len(self.tabs) and 0 <= tab_num:
|
||||||
|
self.set_active_tab(tab_num)
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(self.tabs)
|
return iter(self.tabs)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user