wezterm: Rename tabs

Rename tabs with `<leader><S-R>`. This will provide a (full-screen)
prompt in which you can exit with esc (not changing anything), provide a
static name for the tab, or hit enter with nothing on the prompt to
return to the default naming behavior.
This commit is contained in:
Marty Oehme 2025-09-27 11:02:32 +02:00
parent 1f328d2663
commit c3e2720b3c
Signed by: Marty
GPG key ID: 4E535BC19C61886E

View file

@ -52,6 +52,19 @@ local keys = {
mods = "LEADER|CTRL", mods = "LEADER|CTRL",
action = act.PaneSelect({ mode = "MoveToNewTab" }), action = act.PaneSelect({ mode = "MoveToNewTab" }),
}, },
{
key = "R",
mods = "LEADER",
action = act.PromptInputLine({
description = "Enter new name for tab",
action = wezterm.action_callback(function(win, _, line)
if line then
win:active_tab():set_title(line)
end
end),
}),
},
{ key = "c", mods = "LEADER", action = act.SpawnTab("CurrentPaneDomain") }, { key = "c", mods = "LEADER", action = act.SpawnTab("CurrentPaneDomain") },
{ key = ",", mods = "LEADER", action = act.ActivateTabRelative(-1) }, { key = ",", mods = "LEADER", action = act.ActivateTabRelative(-1) },
{ key = ".", mods = "LEADER", action = act.ActivateTabRelative(1) }, -- workspace selection { key = ".", mods = "LEADER", action = act.ActivateTabRelative(1) }, -- workspace selection
@ -62,6 +75,7 @@ local keys = {
mods = "LEADER", mods = "LEADER",
action = act.ShowLauncherArgs({ flags = "FUZZY|WORKSPACES" }), action = act.ShowLauncherArgs({ flags = "FUZZY|WORKSPACES" }),
}, },
{ key = "t", mods = "LEADER", action = act.EmitEvent("toggle-tabbar") },
{ key = "T", mods = "LEADER", action = act.ShowTabNavigator }, { key = "T", mods = "LEADER", action = act.ShowTabNavigator },
{ key = "[", mods = "LEADER", action = act.ActivateCopyMode }, { key = "[", mods = "LEADER", action = act.ActivateCopyMode },
{ {
@ -105,7 +119,6 @@ local keys = {
}, },
{ key = "e", mods = "LEADER", action = act.EmitEvent("edit-scrollback") }, { key = "e", mods = "LEADER", action = act.EmitEvent("edit-scrollback") },
{ key = "a", mods = "CTRL|ALT", action = act.EmitEvent("toggle-leader") }, { key = "a", mods = "CTRL|ALT", action = act.EmitEvent("toggle-leader") },
{ key = "t", mods = "LEADER", action = act.EmitEvent("toggle-tabbar") },
{ {
key = ":", key = ":",
mods = "LEADER|SHIFT", mods = "LEADER|SHIFT",