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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
|
local wezterm = require "wezterm"
local cfg = wezterm.config_builder()
-- Miscellaneous
cfg.adjust_window_size_when_changing_font_size = false
cfg.allow_square_glyphs_to_overflow_width = "Never"
cfg.allow_win32_input_mode = false
cfg.anti_alias_custom_block_glyphs = false
cfg.audible_bell = "Disabled"
cfg.font_size = 9
cfg.scrollback_lines = 2137
cfg.selection_word_boundary = " \t\n{}[]()'\"`.,;:"
-- Unicode select menu
cfg.char_select_bg_color = "#282c34"
cfg.char_select_fg_color = "#eff1f5"
cfg.char_select_font_size = 13
cfg.warn_about_missing_glyphs = false
-- Colors
cfg.color_scheme = "Pro"
cfg.colors = {
cursor_bg = "#fff",
cursor_fg = "#000",
cursor_border = "#999"
}
-- Tab bar
cfg.hide_tab_bar_if_only_one_tab = true
cfg.show_close_tab_button_in_tabs = false
cfg.show_new_tab_button_in_tab_bar = false
cfg.show_tab_index_in_tab_bar = false
wezterm.on(
'format-tab-title',
function(tab, tabs, panes, config, hover, max_width)
local title = tab.active_pane.title
local part_to_remove = "mosder@archtop:"
return string.gsub(title, part_to_remove, "")
end
)
-- Window
cfg.window_background_opacity = 0.9
cfg.window_frame = {
-- Would love to set alpha of both of these to 0.9, but it incorrectly applies
-- to the area above the tabs themselves, so it's 1 for now
active_titlebar_bg = "rgba(40,44,52,1)",
inactive_titlebar_bg = "rgba(40,44,52,1)",
font_size = 11
}
cfg.window_padding = {
left = 5,
right = 5,
top = 2,
bottom = 2,
}
-- Key bindings
local act = wezterm.action
cfg.disable_default_key_bindings = true
cfg.keys = {
-- Delete last word (Remap ALT+Backspace to CTRL+Backspace)
{
mods = 'CTRL',
key = 'Backspace',
action = act.SendKey { mods = 'ALT', key = 'Backspace' }
},
-- Copy mode
{
mods = 'CTRL|SHIFT',
key = 'X',
action = act.ActivateCopyMode
},
-- Change tabs - relative
{
mods = 'CTRL',
key = 'Tab',
action = act.ActivateTabRelative(1)
},
{
mods = 'CTRL|SHIFT',
key = 'Tab',
action = act.ActivateTabRelative(-1)
},
-- Unicode menu
{
mods = 'CTRL',
key = 'u',
action = act.CharSelect
},
-- Close current tab
{
mods = 'CTRL',
key = 'w',
action = act.CloseCurrentTab { confirm = true }
},
{
mods = 'CTRL',
key = 'q',
action = act.CloseCurrentTab { confirm = true }
},
-- Copy selection to clipboard
{
mods = 'CTRL|SHIFT',
key = 'c',
action = act.CopyTo 'Clipboard'
},
-- Decrease font size
{
mods = 'CTRL',
key = '-',
action = act.DecreaseFontSize
},
-- Increase font size
{
mods = 'CTRL',
key = '=',
action = act.IncreaseFontSize
},
-- Move tabs - relative
{
mods = 'CTRL|SHIFT',
key = 'LeftArrow',
action = act.MoveTabRelative(-1)
},
{
mods = 'CTRL|SHIFT',
key = 'RightArrow',
action = act.MoveTabRelative(1)
},
-- Pase from clipboard
{
mods = 'CTRL|SHIFT',
key = 'v',
action = act.PasteFrom 'Clipboard'
},
{
mods = 'SHIFT',
key = 'Insert',
action = act.PasteFrom 'Clipboard'
},
-- Reset font size
{
mods = 'CTRL',
key = 'p',
action = act.ResetFontSize
},
-- Search
{
mods = 'CTRL',
key = 'f',
action = act.Search('CurrentSelectionOrEmptyString')
},
-- Debug
{
mods = 'CTRL',
key = 'd',
action = act.ShowDebugOverlay
},
-- New tab
{
mods = 'CTRL',
key = 't',
action = act.SpawnTab 'CurrentPaneDomain'
}
}
-- Change tabs
for i = 0, 9 do
table.insert(cfg.keys, {
mods = 'CTRL',
key = tostring(i),
action = act.ActivateTab(i - 1)
})
end
-- Move tabs (no support for -1, so a script instead)
local special_characters = {'!', '@', '#', '$', '%', '^', '&', '*', '('}
for i = 1, 9 do
table.insert(cfg.keys, {
mods = 'CTRL|SHIFT',
key = special_characters[i],
action = act.MoveTab(i - 1)
})
end
wezterm.on("move-tab-to-last-spot", function(window, pane)
local tabs = window:mux_window():tabs()
window:perform_action(act.MoveTab(#tabs - 1), pane)
end)
table.insert(cfg.keys, {
mods = 'CTRL|SHIFT',
key = ')',
action = act.EmitEvent 'move-tab-to-last-spot'
})
return cfg
|