-
Notifications
You must be signed in to change notification settings - Fork 0
/
.wezterm.lua
172 lines (158 loc) · 4.03 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
-- [https://google.com]
local wezterm = require("wezterm")
local function scheme_for_appearance(appearance)
if appearance:find("Dark") then
return "Catppuccin Mocha"
else
return "Catppuccin Latte"
end
end
local config = {}
config.debug_key_events = true
config.term = "wezterm"
config.window_close_confirmation = "NeverPrompt"
-- config.font = wezterm.font({
-- family = "Berkeley Mono Trial",
-- harfbuzz_features = { "liga", "dlig", "ss01", "ss02", "ss03", "ss04", "ss05", "ss06", "ss07", "ss08" },
-- })
config.font_size = 14.0
config.color_scheme = scheme_for_appearance(wezterm.gui.get_appearance())
config.automatically_reload_config = true
config.tab_bar_at_bottom = true
config.use_fancy_tab_bar = false
config.tab_max_width = 32
config.front_end = "WebGpu"
local gpu = wezterm.gui.enumerate_gpus()[0]
config.webgpu_preferred_adapter = gpu
config.leader = { key = "a", mods = "CTRL" }
config.window_padding = {
left = 0,
right = 0,
top = 8,
bottom = 0,
}
config.keys = {
{
key = "r",
mods = "LEADER",
action = wezterm.action.ActivateKeyTable({
name = "resize_pane",
timeout_milliseconds = 1000,
}),
},
{
key = "v",
mods = "LEADER",
action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
},
{
key = "b",
mods = "LEADER",
action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }),
},
{
key = "a",
mods = "LEADER|CTRL",
action = wezterm.action.SendKey({ key = "a", mods = "CTRL" }),
},
{
key = "h",
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection("Left"),
},
{
key = "l",
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection("Right"),
},
{
key = "k",
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection("Up"),
},
{
key = "j",
mods = "LEADER",
action = wezterm.action.ActivatePaneDirection("Down"),
},
{ key = "c", mods = "LEADER", action = wezterm.action.SpawnTab("CurrentPaneDomain") },
{ key = "w", mods = "LEADER", action = wezterm.action.SwitchToWorkspace },
{
key = "H",
mods = "ALT|SHIFT",
action = wezterm.action.AdjustPaneSize({ "Left", 5 }),
},
{
key = "J",
mods = "ALT|SHIFT",
action = wezterm.action.AdjustPaneSize({ "Down", 5 }),
},
{ key = "K", mods = "ALT|SHIFT", action = wezterm.action.AdjustPaneSize({ "Up", 5 }) },
{
key = "L",
mods = "ALT|SHIFT",
action = wezterm.action.AdjustPaneSize({ "Right", 5 }),
},
{
key = "s",
mods = "LEADER",
action = wezterm.action.ShowLauncherArgs({ flags = "FUZZY|WORKSPACES" }),
},
{
key = "z",
mods = "LEADER",
action = wezterm.action.TogglePaneZoomState,
},
{ key = ">", mods = "LEADER", action = wezterm.action.RotatePanes("Clockwise") },
{ key = "<", mods = "LEADER", action = wezterm.action.RotatePanes("CounterClockwise") },
}
wezterm.on("update-right-status", function(window, pane)
local date = wezterm.strftime("%a %b %-d %H:%M ")
local bat = ""
for _, b in ipairs(wezterm.battery_info()) do
bat = "🔋 " .. string.format("%.0f%%", b.state_of_charge * 100)
end
window:set_right_status(wezterm.format({
{ Text = bat .. " " .. date },
}))
end)
-- Work around for this issue:
-- https://github.com/wez/wezterm/issues/3803
config.hyperlink_rules = {
-- Matches: a URL in parens: (URL)
{
regex = "\\((\\w+://\\S+)\\)",
format = "$1",
highlight = 1,
},
-- Matches: a URL in brackets: [URL]
{
regex = "\\[(\\w+://\\S+)\\]",
format = "$1",
highlight = 1,
},
-- Matches: a URL in curly braces: {URL}
{
regex = "\\{(\\w+://\\S+)\\}",
format = "$1",
highlight = 1,
},
-- Matches: a URL in angle brackets: <URL>
{
regex = "<(\\w+://\\S+)>",
format = "$1",
highlight = 1,
},
-- Then handle URLs not wrapped in brackets
{
regex = "[^(]\\b(\\w+://\\S+[)/a-zA-Z0-9-]+)",
format = "$1",
highlight = 1,
},
-- implicit mailto link
{
regex = "\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b",
format = "mailto:$0",
},
}
return config