-
Notifications
You must be signed in to change notification settings - Fork 0
/
wezterm.lua
83 lines (77 loc) · 2.08 KB
/
wezterm.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
-- Pull in the wezterm API #
local wezterm = require("wezterm")
local function is_vim(pane)
-- this is set by the plugin, and unset on ExitPre in Neovim
return pane:get_user_vars().IS_NVIM == "true"
end
-- This will hold the configuration.
local config = wezterm.config_builder()
local direction_keys = {
Left = "h",
Down = "j",
Up = "k",
Right = "l",
-- reverse lookup
h = "Left",
j = "Down",
k = "Up",
l = "Right",
}
local function split_nav(resize_or_move, key)
return {
key = key,
mods = resize_or_move == "resize" and "META" or "CTRL",
action = wezterm.action_callback(function(win, pane)
if is_vim(pane) then
-- pass the keys through to vim/nvim
win:perform_action({
SendKey = { key = key, mods = resize_or_move == "resize" and "META" or "CTRL" },
}, pane)
else
if resize_or_move == "resize" then
win:perform_action({ AdjustPaneSize = { direction_keys[key], 3 } }, pane)
else
win:perform_action({ ActivatePaneDirection = direction_keys[key] }, pane)
end
end
end),
}
end
-- This is where you actually apply your config choices
-- For example, changing the color scheme:
config.color_scheme = "Solarized Dark (Gogh)"
config.font = wezterm.font("Red Hat Mono")
config.window_decorations = "RESIZE"
config.hide_tab_bar_if_only_one_tab = true
-- Leader is the same as my old tmux prefix
config.leader = { key = "b", mods = "CTRL", timeout_milliseconds = 1000 }
config.keys = {
-- splitting
{
mods = "LEADER",
key = "-",
action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }),
},
{
mods = "LEADER",
key = "%",
action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
},
{
mods = "LEADER",
key = "z",
action = wezterm.action.TogglePaneZoomState,
},
split_nav("move", "h"),
split_nav("move", "j"),
split_nav("move", "k"),
split_nav("move", "l"),
-- resize panes
split_nav("resize", "h"),
split_nav("resize", "j"),
split_nav("resize", "k"),
split_nav("resize", "l"),
}
config.send_composed_key_when_left_alt_is_pressed = true
-- and finally, return the configuration to wezterm
return config