1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-24 05:42:03 +03:00
wezterm/docs/config/lua/keyassignment/ActivateTab.md
Wez Furlong 809bb53387 docs: split out the KeyAssignment enum variants
This makes the individual functions a bit easier to discover,
and a lot easier to link to.
2020-10-10 08:45:13 -07:00

794 B

ActivateTab

Activate the tab specified by the argument value. eg: 0 activates the leftmost tab, while 1 activates the second tab from the left, and so on.

since: 20200620-160318-e00b076c

ActivateTab now accepts negative numbers; these wrap around from the start of the tabs to the end, so -1 references the right-most tab, -2 the tab to its left and so on.

local wezterm = require 'wezterm';

local mykeys = {}
for i = 1, 8 do
  -- CTRL+ALT + number to activate that tab
  table.insert(mykeys, {
    key=tostring(i),
    mods="CTRL|ALT",
    action=wezterm.action{ActivateTab=i-1},
  })
  -- F1 through F8 to activate that tab
  table.insert(mykeys, {
    key="F" .. tostring(i),
    action=wezterm.action{ActivateTab=i-1},
  })
end

return {
  keys = mykeys,
}