wezterm: Added toggling ability for leader key
Sometimes the leader key gets in the way. Since my leader key combination is C-a by default, this interferes with the (rare) times that I want to increment something in vim (also C-a). So, this commit allows toggling the leader key in wezterm off, so it passes through to the actual applications. You can toggle it with `C-Alt-a`. Commit made possible with the help of the comments in this issue: https://github.com/wez/wezterm/issues/656
This commit is contained in:
parent
2e6c1026fb
commit
205c48633f
2 changed files with 17 additions and 2 deletions
|
@ -58,6 +58,20 @@ local function setup()
|
||||||
wezterm.sleep_ms(1000)
|
wezterm.sleep_ms(1000)
|
||||||
os.remove(name)
|
os.remove(name)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
wezterm.on("toggle-leader", function(window, pane)
|
||||||
|
wezterm.log_info("toggling the leader")
|
||||||
|
local overrides = window:get_config_overrides() or {}
|
||||||
|
if not overrides.leader then
|
||||||
|
wezterm.log_info("leader wasn't set")
|
||||||
|
overrides.leader = { key = "s", mods = "SUPER" };
|
||||||
|
else
|
||||||
|
wezterm.log_info("leader was set")
|
||||||
|
overrides.leader = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
window:set_config_overrides(overrides)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return { setup = setup }
|
return { setup = setup }
|
||||||
|
|
|
@ -73,7 +73,8 @@ local keys = {
|
||||||
key = 'l',
|
key = 'l',
|
||||||
mods = 'LEADER',
|
mods = 'LEADER',
|
||||||
action = act.EmitEvent 'ActivatePaneDirection-Right'
|
action = act.EmitEvent 'ActivatePaneDirection-Right'
|
||||||
}
|
},
|
||||||
|
{ key = 'a', mods = 'CTRL|ALT', action = act.EmitEvent 'toggle-leader'}
|
||||||
|
|
||||||
}
|
}
|
||||||
-- Leader + number to activate that tab
|
-- Leader + number to activate that tab
|
||||||
|
@ -108,6 +109,6 @@ local key_tables = {
|
||||||
{ key = 'g', mods = 'CTRL', action = act.ScrollToTop },
|
{ key = 'g', mods = 'CTRL', action = act.ScrollToTop },
|
||||||
{ key = 'G', mods = 'CTRL', action = act.ScrollToBottom },
|
{ key = 'G', mods = 'CTRL', action = act.ScrollToBottom },
|
||||||
{ key = 'Escape', action = 'PopKeyTable' }
|
{ key = 'Escape', action = 'PopKeyTable' }
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
return { keys = keys, key_tables = key_tables }
|
return { keys = keys, key_tables = key_tables }
|
||||||
|
|
Loading…
Reference in a new issue