Lua · 11057 bytes Raw Blame History
1 -- :::
2 -- :::: sample.lua ::::
3 -- ::::::::::::::::::::::
4 --
5 -- Author: @espadonne (mfw)
6 -- Description: just my wezterm config.
7 -- but it's decorated for use with
8 -- my lil PyQt6 widget, wezztershier.
9 -- That tool looks at a WezTerm config with decorations
10 -- of my pleasing, and allows live editing of the terminal
11 -- emulator's visual effects via PyQT6 gui.
12 --
13
14
15 -- :::
16 -- :::: BOILERPLATE ::::
17 -- :::::::::::::::::::::::
18 --
19 local wezterm = require 'wezterm'
20
21 local config = {}
22 if wezterm.config_builder then
23 config = wezterm.config_builder()
24 end
25
26
27 -- :::
28 -- :::: TUNER FOR WEZZTERSHIER ::::
29 -- ::::: :::::::::::::::::::::: :::::
30
31 -- <<TUNER-START>>
32 -- @ui: slider(min=10, max=42, step=1) type=int
33 config.font_size = 27
34
35 -- @ui: select(options="Birds of Paradise,Gotham (terminal.sexy),Grape,Grass,Hardcore (base16),hardhacker,Harmonic16 Dark (base16),Harper (Gogh),HaX0R_BLUE,Heetch Dark (base16),Hemisu Dark (Gogh),Highway,Highway (Gogh),Hivacruz,Hopscotch,Hybrid (Gogh),Ibm 3270 (High Contrast) (Gogh),Ic Orange Ppl (Gogh),IC_Orange_PPL,Ivory Dark (terminal.sexy),Jackie Brown,Japanesque,JetBrains Darcula,jmbi (terminal.sexy)") type=string
36 config.color_scheme = "Hardcore (base16)"
37
38 -- @ui: select(options="JetBrains Mono, Fira Code, Cascadia Code, Source Code Pro, Hack, Consolas, Monaco, Menlo, DejaVu Sans Mono, Ubuntu Mono, Roboto Mono, IBM Plex Mono, Inconsolata") type=string
39 config.font = wezterm.font("JetBrains Mono")
40
41 -- @ui: numerical(min=0.5, max=5.5, step=0.01) type=float
42 config.line_height = 1.29
43
44 -- @ui: numerical(min=0.5, max=2.0, step=0.1) type=float
45 config.cell_width = 1.0
46
47 -- @ui: slider(min=0.05, max=1.0, step=0.01) type=float
48 config.window_background_opacity = 0.26
49
50 -- @ui: slider(min=1, max=100, step=1) type=int
51 config.macos_window_background_blur = 22
52
53 -- @ui: color_picker(format="hex", alpha=false) type=color
54 config.colors = config.colors or {}
55 config.colors.background = "#333333"
56
57 -- @ui: color_picker(format="hex", alpha=false) type=color
58 config.colors = config.colors or {}
59 config.colors.tab_bar = config.colors.tab_bar or {}
60 config.colors.tab_bar.background = "#333333"
61
62 -- @ui: color_picker(format="hex", alpha=false) type=color
63 config.colors = config.colors or {}
64 config.colors.tab_bar = config.colors.tab_bar or {}
65 config.colors.tab_bar.active_tab = config.colors.tab_bar.active_tab or {}
66 config.colors.tab_bar.active_tab.bg_color = "#444444"
67
68 -- @ui: color_picker(format="hex", alpha=false) type=color
69 config.colors = config.colors or {}
70 config.colors.tab_bar = config.colors.tab_bar or {}
71 config.colors.tab_bar.active_tab = config.colors.tab_bar.active_tab or {}
72 config.colors.tab_bar.active_tab.fg_color = "#ffffff"
73
74 -- @ui: color_picker(format="hex", alpha=false) type=color
75 config.colors = config.colors or {}
76 config.colors.tab_bar = config.colors.tab_bar or {}
77 config.colors.tab_bar.inactive_tab = config.colors.tab_bar.inactive_tab or {}
78 config.colors.tab_bar.inactive_tab.bg_color = "#333333"
79
80 -- @ui: color_picker(format="hex", alpha=false) type=color
81 config.colors = config.colors or {}
82 config.colors.tab_bar = config.colors.tab_bar or {}
83 config.colors.tab_bar.inactive_tab = config.colors.tab_bar.inactive_tab or {}
84 config.colors.tab_bar.inactive_tab.fg_color = "#888888"
85
86 -- @ui: slider(min=0, max=2000, step=100) type=int
87 config.cursor_blink_rate = 500
88
89 -- @ui: select(options="true, false") type=string
90 config.hide_tab_bar_if_only_one_tab = true
91
92 -- @ui: select(options="NONE, RESIZE, TITLE, RESIZE|TITLE") type=string
93 config.window_decorations = "RESIZE|TITLE"
94
95 -- @ui: select(options="true, false") type=string
96 config.pane_focus_follows_mouse = false
97
98 -- @ui: select(options="true, false") type=string
99 config.native_macos_fullscreen_mode = true
100
101 -- @ui: numerical(min=100, max=10000, step=100) type=int
102 config.scrollback_lines = 3500
103
104 -- @ui: select(options="true, false") type=string
105 config.enable_scroll_bar = true
106
107 -- @ui: slider(min=1, max=60, step=1) type=int
108 config.animation_fps = 60
109
110 -- @ui: slider(min=1, max=120, step=1) type=int
111 config.max_fps = 60
112
113 -- @ui: select(options="true, false") type=string
114 config.tab_bar_at_bottom = false
115
116 -- @ui: numerical(min=50, max=500, step=10) type=int
117 config.tab_max_width = 200
118
119 -- @ui: select(options="SystemBeep, Disabled") type=string
120 config.audible_bell = "SystemBeep"
121
122 -- @ui: select(options="true, false") type=string
123 config.hide_mouse_cursor_when_typing = true
124
125 -- @ui: select(options="true, false") type=string
126 config.swallow_mouse_click_on_window_focus = false
127
128 -- @ui: select(options="true, false") type=string
129 config.debug_key_events = false
130
131 -- <<TUNER-END>>
132
133
134 -- :::
135 -- :::: DYNAMICS :: the spice of life ::::
136 -- ::::: ::::::::::::::::::::::::::::: :::::
137 --
138 -- NOTE: just a clock for now lol, and I hide
139 -- it most of the time, too ..lol
140 wezterm.on("update-right-status", function(window, pane)
141 local date = wezterm.strftime(" %Y-%m-%d %H:%M:%S ")
142 window:set_right_status(date)
143 end)
144
145
146 -- :::
147 -- :::: KEYBINDS :: my onetrue ::::
148 -- ::::: :::::::::::::::::::::: :::::
149 --
150
151 config.key_tables = {
152 resize = {
153 { key="Escape", action = "PopKeyTable" },
154 { key="UpArrow", action = wezterm.action.AdjustPaneSize{"Up", 2} },
155 { key="DownArrow", action = wezterm.action.AdjustPaneSize{"Down",2} },
156 { key="LeftArrow", action = wezterm.action.AdjustPaneSize{"Left", 2} },
157 { key="RightArrow", action = wezterm.action.AdjustPaneSize{"Right", 2} },
158 },
159
160 utility = {
161 { key="c", action = wezterm.action.ActivateCopyMode },
162 { key="Escape", action = wezterm.action.ReloadConfiguration },
163 {
164 key = "b",
165 action = wezterm.action_callback(function(win)
166 local o = win:get_config_overrides() or {}
167 o.hide_tab_bar_if_only_one_tab = not o.hide_tab_bar_if_only_one_tab
168 win:set_config_overrides(o)
169 end),
170 },
171 {
172 key = "l", mods = "CMD|SHIFT",
173 action = wezterm.action_callback(function(win)
174 local o = win:get_config_overrides() or {}
175 o.enable_scroll_bar = not o.enable_scroll_bar
176 win:set_config_overrides(o)
177 end),
178 },
179 },
180
181 tabular = {
182 { key="n", action = wezterm.action.SpawnTab("CurrentPaneDomain") },
183 { key="RightArrow", action = wezterm.action.ActivateTabRelative(1) },
184 { key="LeftArrow", action = wezterm.action.ActivateTabRelative(-1) },
185 { key="w", action = wezterm.action.CloseCurrentTab { confirm = false } },
186 }
187 }
188
189
190 config.keys = {
191
192 -- :::
193 -- :::: MODALLY WE ROLL ALONG ::::
194 -- ::::: ::::::::::::::::::::: :::::
195 --
196
197 -- utility
198 {
199 key = "U",
200 mods = "CMD|SHIFT",
201 action = wezterm.action.ActivateKeyTable{
202 name = "utility",
203 one_shot = true
204 },
205 },
206
207 -- resize
208 {
209 key = "R",
210 mods = "CMD|SHIFT",
211 action = wezterm.action.ActivateKeyTable{
212 name = "resize",
213 one_shot = false
214 },
215 },
216
217 -- tabs (mostly fallbacks)
218 {
219 key = "T",
220 mods = "CMD|SHIFT",
221 action = wezterm.action.ActivateKeyTable{
222 name = "tabular",
223 one_shot = false
224 },
225 },
226
227 -- this bind causes erratic behavior with multiple panes open
228 {
229 key = 'Z',
230 mods = 'CTRL|SHIFT',
231 action = wezterm.action.DisableDefaultAssignment,
232 },
233
234
235
236 -- :::
237 -- :::: TABBY-THINGS ::::
238 -- ::::: :::::::::::: :::::
239 --
240
241 {
242 key = "W",
243 mods = "CTRL|SHIFT",
244 action = wezterm.action.CloseCurrentTab { confirm = false },
245 },
246 {
247 key = "T",
248 mods = "CTRL|SHIFT",
249 action = wezterm.action.SpawnTab("CurrentPaneDomain"),
250 },
251
252 {
253 key = "RightArrow",
254 mods = "CMD|ALT",
255 action = wezterm.action.ActivateTabRelative(1),
256 },
257 {
258 key = "Tab",
259 mods = "CTRL",
260 action = wezterm.action.ActivateTabRelative(1),
261 },
262 {
263 key = "LeftArrow",
264 mods = "CMD|ALT",
265 action = wezterm.action.ActivateTabRelative(-1),
266 },
267 {
268 key = "Tab",
269 mods = "SHIFT|CTRL",
270 action = wezterm.action.ActivateTabRelative(-1),
271 },
272
273 -- :::
274 -- :::: PANEY-THINGS ::::
275 -- ::::: :::::::::::: :::::
276 --
277
278 -- better resize, keep mode though
279 {
280 key="UpArrow",
281 mods = "CMD|CTRL",
282 action = wezterm.action.AdjustPaneSize{"Up", 2}
283 },
284
285 {
286 key="LeftArrow",
287 mods = "CMD|CTRL",
288 action = wezterm.action.AdjustPaneSize{"Left", 2}
289 },
290
291 {
292 key="RightArrow",
293 mods = "CMD|CTRL",
294 action = wezterm.action.AdjustPaneSize{"Right", 2}
295 },
296
297 {
298 key="DownArrow",
299 mods = "CMD|CTRL",
300 action = wezterm.action.AdjustPaneSize{"Down", 2}
301 },
302
303 -- creation/deltion
304 {
305 key = "X",
306 mods = "CTRL|SHIFT",
307 action = wezterm.action.CloseCurrentPane { confirm = true },
308 },
309 {
310 key = "\\",
311 mods = "CMD",
312 action = wezterm.action.SplitVertical { domain = "CurrentPaneDomain" },
313 },
314 {
315 key = "\\",
316 mods = "CMD|SHIFT",
317 action = wezterm.action.SplitHorizontal { domain = "CurrentPaneDomain" },
318 },
319
320 -- navigation..
321 -- these are just keybinds
322 -- I've always liked for nav
323 -- within application 'panes' != tabs!
324 {
325 key = "LeftArrow",
326 mods = "CMD|CTRL|ALT",
327 action = wezterm.action.ActivatePaneDirection("Left"),
328 },
329 {
330 key = "RightArrow",
331 mods = "CMD|CTRL|ALT",
332 action = wezterm.action.ActivatePaneDirection("Right"),
333 },
334 {
335 key = "UpArrow",
336 mods = "CMD|CTRL|ALT",
337 action = wezterm.action.ActivatePaneDirection("Up"),
338 },
339 {
340 key = "DownArrow",
341 mods = "CMD|CTRL|ALT",
342 action = wezterm.action.ActivatePaneDirection("Down"),
343 },
344
345 -- maximize/minimize pane
346 -- requires overriding the macOS default
347 {
348 key = 'm',
349 mods = 'CMD',
350 action = wezterm.action.DisableDefaultAssignment,
351 },
352
353 {
354 key = "m",
355 mods = "CMD",
356 action = wezterm.action.TogglePaneZoomState,
357 },
358
359 -- :::
360 -- getting my nice cmd readlines back
361 {
362 key = "LeftArrow",
363 mods = "CMD",
364 action = wezterm.action.SendString("\x1b[1;9D"),
365 },
366 {
367 key = "RightArrow",
368 mods = "CMD",
369 action = wezterm.action.SendString("\x1b[1;9C"),
370 },
371
372 -- :::
373 -- :::: VISUAL ::::
374 -- ::::: :::::: :::::
375 --
376
377 -- hi/lo opacity toggle
378 -- note this does not writeback
379 -- to the wezztershier tuning section
380 {
381 key = "o",
382 mods = "CMD",
383 action = wezterm.action_callback(function(window, pane)
384 local overrides = window:get_config_overrides() or {}
385 local opa = overrides.window_background_opacity
386 if opa == nil or opa == 1.0 then
387 overrides.window_background_opacity = 0.05
388 else
389 overrides.window_background_opacity = 1.0
390 end
391 window:set_config_overrides(overrides)
392 end),
393 },
394 }
395
396
397 -- :::
398 -- :::: TAB BAR HOVER STATES ::::
399 -- ::::: ::::::::::::::::::::: :::::
400 --
401 -- NOTE: These can't be easily tuned via GUI
402 -- since they're computed from other values
403 config.colors.tab_bar.inactive_tab_hover = {
404 bg_color = "#444444",
405 fg_color = "#DDDDDD",
406 }
407
408 config.colors.tab_bar.new_tab = {
409 bg_color = "#333333",
410 fg_color = "#FFFFFF",
411 }
412
413 config.colors.tab_bar.new_tab_hover = {
414 bg_color = "#444444",
415 fg_color = "#FFFFFF",
416 }
417
418 return config