Created
March 15, 2022 15:08
My wezterm config with tmux-like bindings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local wezterm = require 'wezterm'; | |
return { | |
color_scheme = "Dracula", | |
-- colors = { | |
-- background = "#0c0e14", | |
-- }, | |
window_decorations = "NONE", | |
font = wezterm.font("Iosevka"), | |
font_size = 10.0, | |
-- dpi = 192.0, | |
font_antialias = "Subpixel", -- None, Greyscale, Subpixel | |
font_hinting = "Full", -- None, Vertical, VerticalSubpixel, Full | |
leader = { key="a", mods="CTRL" }, | |
hide_tab_bar_if_only_one_tab = true, | |
keys = { | |
{ key = "a", mods = "LEADER|CTRL", action=wezterm.action{SendString="\x01"}}, | |
{ key = "-", mods = "LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}}, | |
{ key = "\\",mods = "LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}}, | |
{ key = "s", mods = "LEADER", action=wezterm.action{SplitVertical={domain="CurrentPaneDomain"}}}, | |
{ key = "v", mods = "LEADER", action=wezterm.action{SplitHorizontal={domain="CurrentPaneDomain"}}}, | |
{ key = "o", mods = "LEADER", action="TogglePaneZoomState" }, | |
{ key = "z", mods = "LEADER", action="TogglePaneZoomState" }, | |
{ key = "c", mods = "LEADER", action=wezterm.action{SpawnTab="CurrentPaneDomain"}}, | |
{ key = "h", mods = "LEADER", action=wezterm.action{ActivatePaneDirection="Left"}}, | |
{ key = "j", mods = "LEADER", action=wezterm.action{ActivatePaneDirection="Down"}}, | |
{ key = "k", mods = "LEADER", action=wezterm.action{ActivatePaneDirection="Up"}}, | |
{ key = "l", mods = "LEADER", action=wezterm.action{ActivatePaneDirection="Right"}}, | |
{ key = "H", mods = "LEADER|SHIFT", action=wezterm.action{AdjustPaneSize={"Left", 5}}}, | |
{ key = "J", mods = "LEADER|SHIFT", action=wezterm.action{AdjustPaneSize={"Down", 5}}}, | |
{ key = "K", mods = "LEADER|SHIFT", action=wezterm.action{AdjustPaneSize={"Up", 5}}}, | |
{ key = "L", mods = "LEADER|SHIFT", action=wezterm.action{AdjustPaneSize={"Right", 5}}}, | |
{ key = "1", mods = "LEADER", action=wezterm.action{ActivateTab=0}}, | |
{ key = "2", mods = "LEADER", action=wezterm.action{ActivateTab=1}}, | |
{ key = "3", mods = "LEADER", action=wezterm.action{ActivateTab=2}}, | |
{ key = "4", mods = "LEADER", action=wezterm.action{ActivateTab=3}}, | |
{ key = "5", mods = "LEADER", action=wezterm.action{ActivateTab=4}}, | |
{ key = "6", mods = "LEADER", action=wezterm.action{ActivateTab=5}}, | |
{ key = "7", mods = "LEADER", action=wezterm.action{ActivateTab=6}}, | |
{ key = "8", mods = "LEADER", action=wezterm.action{ActivateTab=7}}, | |
{ key = "9", mods = "LEADER", action=wezterm.action{ActivateTab=8}}, | |
{ key = "&", mods = "LEADER|SHIFT", action=wezterm.action{CloseCurrentTab={confirm=true}}}, | |
{ key = "d", mods = "LEADER", action=wezterm.action{CloseCurrentPane={confirm=true}}}, | |
{ key = "x", mods = "LEADER", action=wezterm.action{CloseCurrentPane={confirm=true}}}, | |
}, | |
} |
Echoing the message above, really good config to start with, thank you.
That should go into official documentation. Plenty of people like me have tmux keybindings hardwired into their brains
Thank you so much for this snippet! Saved me an hour 🙌
allow repeating J H K L when resizing:
{
key = "h",
mods = "LEADER|SHIFT",
action = wezterm.action.Multiple({
wezterm.action.AdjustPaneSize({ "Left", 5 }),
wezterm.action.ActivateKeyTable({ name = "resize_pane", one_shot = false, until_unknown = true }),
}),
},
{
key = "j",
mods = "LEADER|SHIFT",
action = wezterm.action.Multiple({
wezterm.action.AdjustPaneSize({ "Down", 5 }),
wezterm.action.ActivateKeyTable({ name = "resize_pane", one_shot = false, until_unknown = true }),
}),
},
{
key = "k",
mods = "LEADER|SHIFT",
action = wezterm.action.Multiple({
wezterm.action.AdjustPaneSize({ "Up", 5 }),
wezterm.action.ActivateKeyTable({ name = "resize_pane", one_shot = false, until_unknown = true }),
}),
},
{
key = "l",
mods = "LEADER|SHIFT",
action = wezterm.action.Multiple({
wezterm.action.AdjustPaneSize({ "Right", 5 }),
wezterm.action.ActivateKeyTable({ name = "resize_pane", one_shot = false, until_unknown = true }),
}),
},
# then
config.key_tables.resize_pane = {
{ key = "h", mods = "SHIFT", action = wezterm.action.AdjustPaneSize({ "Left", 5 }) },
{ key = "j", mods = "SHIFT", action = wezterm.action.AdjustPaneSize({ "Down", 5 }) },
{ key = "k", mods = "SHIFT", action = wezterm.action.AdjustPaneSize({ "Up", 5 }) },
{ key = "l", mods = "SHIFT", action = wezterm.action.AdjustPaneSize({ "Right", 5 }) },
{ key = "Escape", action = wezterm.action.PopKeyTable },
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just made my day a whole lot easier!