-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.wezterm.lua
200 lines (192 loc) · 12.8 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
local wezterm = require 'wezterm'
local mux = wezterm.mux
local act = wezterm.action
local config = {}
local keys = {}
local mouse_bindings = {}
local launch_menu = {}
--- Setup PowerShell options
if wezterm.target_triple == 'x86_64-pc-windows-msvc' then
--- Grab the ver info for later use.
local success, stdout, stderr = wezterm.run_child_process { 'cmd.exe', 'ver' }
local major, minor, build, rev = stdout:match("Version ([0-9]+)%.([0-9]+)%.([0-9]+)%.([0-9]+)")
local is_windows_11 = tonumber(build) >= 22000
--- Set Pwsh as the default on Windows
config.default_prog = { "pwsh" }
table.insert(launch_menu, {
label = 'Pwsh',
args = { 'pwsh.exe', '-NoLogo' },
})
table.insert(launch_menu, {
label = 'Pwsh No Profile',
args = { 'pwsh.exe', '-NoLogo', '-NoProfile' },
})
table.insert(launch_menu, {
label = 'PowerShell',
args = { 'powershell.exe', '-NoLogo' },
})
table.insert(launch_menu, {
label = 'PowerShell No Profile',
args = { 'powershell.exe', '-NoLogo', '-NoProfile' },
})
end
--- Disable default keys and set some minimum ones for now.
--- This helps with conflicting keys in pwsh
keys = {
{ key = 'Tab', mods = 'CTRL', action = act.ActivateTabRelative(1) },
{ key = 'Tab', mods = 'SHIFT|CTRL', action = act.ActivateTabRelative(-1) },
{ key = 'Enter', mods = 'ALT', action = act.ToggleFullScreen },
{ key = '!', mods = 'CTRL', action = act.ActivateTab(0) },
{ key = '!', mods = 'SHIFT|CTRL', action = act.ActivateTab(0) },
{ key = '\"', mods = 'ALT|CTRL', action = act.SplitVertical { domain = 'CurrentPaneDomain' } },
{ key = '\"', mods = 'SHIFT|ALT|CTRL', action = act.SplitVertical { domain = 'CurrentPaneDomain' } },
{ key = '#', mods = 'CTRL', action = act.ActivateTab(2) },
{ key = '#', mods = 'SHIFT|CTRL', action = act.ActivateTab(2) },
{ key = '$', mods = 'CTRL', action = act.ActivateTab(3) },
{ key = '$', mods = 'SHIFT|CTRL', action = act.ActivateTab(3) },
{ key = '%', mods = 'CTRL', action = act.ActivateTab(4) },
{ key = '%', mods = 'SHIFT|CTRL', action = act.ActivateTab(4) },
{ key = '%', mods = 'ALT|CTRL', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' } },
{ key = '%', mods = 'SHIFT|ALT|CTRL', action = act.SplitHorizontal { domain = 'CurrentPaneDomain' } },
{ key = '&', mods = 'CTRL', action = act.ActivateTab(6) },
{ key = '&', mods = 'SHIFT|CTRL', action = act.ActivateTab(6) },
{ key = '\'', mods = 'SHIFT|ALT|CTRL', action = act.SplitVertical { domain = 'CurrentPaneDomain' } },
{ key = '(', mods = 'CTRL', action = act.ActivateTab(-1) },
{ key = '(', mods = 'SHIFT|CTRL', action = act.ActivateTab(-1) },
{ key = ')', mods = 'CTRL', action = act.ResetFontSize },
{ key = ')', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
{ key = '*', mods = 'CTRL', action = act.ActivateTab(7) },
{ key = '*', mods = 'SHIFT|CTRL', action = act.ActivateTab(7) },
{ key = '+', mods = 'CTRL', action = act.IncreaseFontSize },
{ key = '+', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
{ key = '-', mods = 'CTRL', action = act.DecreaseFontSize },
{ key = '-', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },
{ key = '-', mods = 'SUPER', action = act.DecreaseFontSize },
{ key = '0', mods = 'CTRL', action = act.ResetFontSize },
{ key = '0', mods = 'SHIFT|CTRL', action = act.ResetFontSize },
{ key = '0', mods = 'SUPER', action = act.ResetFontSize },
-- I use Ctrl + Number in all my other apps.
-- I also never have more the 5 tabs
{ key = '1', mods = 'CTRL', action = act.ActivateTab(0) },
{ key = '2', mods = 'CTRL', action = act.ActivateTab(1) },
{ key = '3', mods = 'CTRL', action = act.ActivateTab(2) },
{ key = '4', mods = 'CTRL', action = act.ActivateTab(3) },
{ key = '5', mods = 'CTRL', action = act.ActivateTab(4) },
{ key = '=', mods = 'CTRL', action = act.IncreaseFontSize },
{ key = '=', mods = 'SHIFT|CTRL', action = act.IncreaseFontSize },
{ key = '=', mods = 'SUPER', action = act.IncreaseFontSize },
{ key = '@', mods = 'CTRL', action = act.ActivateTab(1) },
{ key = '@', mods = 'SHIFT|CTRL', action = act.ActivateTab(1) },
{ key = "B", mods = "CTRL", action = wezterm.action { EmitEvent = "toggle-opacity" } },
{ key = 'C', mods = 'CTRL', action = act.CopyTo 'Clipboard' },
{ key = 'C', mods = 'SHIFT|CTRL', action = act.CopyTo 'Clipboard' },
{ key = 'F', mods = 'CTRL', action = act.Search 'CurrentSelectionOrEmptyString' },
{ key = 'F', mods = 'SHIFT|CTRL', action = act.Search 'CurrentSelectionOrEmptyString' },
{ key = 'K', mods = 'CTRL', action = act.ClearScrollback 'ScrollbackOnly' },
{ key = 'K', mods = 'SHIFT|CTRL', action = act.ClearScrollback 'ScrollbackOnly' },
{ key = 'L', mods = 'CTRL', action = act.ShowDebugOverlay },
{ key = 'L', mods = 'SHIFT|CTRL', action = act.ShowDebugOverlay },
{ key = 'M', mods = 'CTRL', action = act.Hide },
{ key = 'M', mods = 'SHIFT|CTRL', action = act.Hide },
{ key = 'N', mods = 'CTRL', action = act.SpawnWindow },
{ key = 'P', mods = 'CTRL', action = act.ActivateCommandPalette },
{ key = 'R', mods = 'CTRL', action = act.ReloadConfiguration },
{ key = 'R', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
{ key = 'T', mods = 'CTRL', action = act.ShowLauncher },
{ key = 'T', mods = 'SHIFT|CTRL', action = act.ShowLauncher },
{ key = 'U', mods = 'CTRL', action = act.CharSelect { copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
{ key = 'U', mods = 'SHIFT|CTRL', action = act.CharSelect { copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
{ key = 'V', mods = 'CTRL', action = act.PasteFrom 'Clipboard' },
{ key = 'W', mods = 'CTRL', action = act.CloseCurrentTab { confirm = true } },
{ key = 'W', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab { confirm = true } },
{ key = 'X', mods = 'CTRL', action = act.ActivateCopyMode },
{ key = 'X', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
{ key = 'Z', mods = 'CTRL', action = act.TogglePaneZoomState },
{ key = 'Z', mods = 'SHIFT|CTRL', action = act.TogglePaneZoomState },
{ key = '[', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(-1) },
{ key = ']', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(1) },
{ key = '^', mods = 'CTRL', action = act.ActivateTab(5) },
{ key = '^', mods = 'SHIFT|CTRL', action = act.ActivateTab(5) },
{ key = '_', mods = 'CTRL', action = act.DecreaseFontSize },
{ key = '_', mods = 'SHIFT|CTRL', action = act.DecreaseFontSize },
{ key = 'c', mods = 'SHIFT|CTRL', action = act.CopyTo 'Clipboard' },
{ key = 'c', mods = 'SUPER', action = act.CopyTo 'Clipboard' },
{ key = 'f', mods = 'SHIFT|CTRL', action = act.Search 'CurrentSelectionOrEmptyString' },
{ key = 'f', mods = 'SUPER', action = act.Search 'CurrentSelectionOrEmptyString' },
{ key = 'k', mods = 'SHIFT|CTRL', action = act.ClearScrollback 'ScrollbackOnly' },
{ key = 'k', mods = 'SUPER', action = act.ClearScrollback 'ScrollbackOnly' },
{ key = 'l', mods = 'SHIFT|CTRL', action = act.ShowDebugOverlay },
{ key = 'm', mods = 'SHIFT|CTRL', action = act.Hide },
{ key = 'm', mods = 'SUPER', action = act.Hide },
{ key = 'n', mods = 'SUPER', action = act.SpawnWindow },
{ key = 'r', mods = 'SHIFT|CTRL', action = act.ReloadConfiguration },
{ key = 'r', mods = 'SUPER', action = act.ReloadConfiguration },
{ key = 't', mods = 'SHIFT|CTRL', action = act.ShowLauncher },
{ key = 't', mods = 'SUPER', action = act.ShowLauncher },
{ key = 'u', mods = 'SHIFT|CTRL', action = act.CharSelect { copy_on_select = true, copy_to = 'ClipboardAndPrimarySelection' } },
{ key = 'v', mods = 'SUPER', action = act.PasteFrom 'Clipboard' },
{ key = 'w', mods = 'SHIFT|CTRL', action = act.CloseCurrentTab { confirm = true } },
{ key = 'w', mods = 'SUPER', action = act.CloseCurrentTab { confirm = true } },
{ key = 'x', mods = 'SHIFT|CTRL', action = act.ActivateCopyMode },
{ key = 'z', mods = 'SHIFT|CTRL', action = act.TogglePaneZoomState },
{ key = '{', mods = 'SUPER', action = act.ActivateTabRelative(-1) },
{ key = '{', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(-1) },
{ key = '}', mods = 'SUPER', action = act.ActivateTabRelative(1) },
{ key = '}', mods = 'SHIFT|SUPER', action = act.ActivateTabRelative(1) },
{ key = 'phys:Space', mods = 'SHIFT|CTRL', action = act.QuickSelect },
{ key = 'PageUp', mods = 'SHIFT', action = act.ScrollByPage(-1) },
{ key = 'PageUp', mods = 'CTRL', action = act.ActivateTabRelative(-1) },
{ key = 'PageUp', mods = 'SHIFT|CTRL', action = act.MoveTabRelative(-1) },
{ key = 'PageDown', mods = 'SHIFT', action = act.ScrollByPage(1) },
{ key = 'PageDown', mods = 'CTRL', action = act.ActivateTabRelative(1) },
{ key = 'PageDown', mods = 'SHIFT|CTRL', action = act.MoveTabRelative(1) },
{ key = 'LeftArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize { 'Left', 1 } },
-- Turning these off so I can use pwsh keys
-- { key = 'LeftArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Left' },
-- { key = 'RightArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Right' },
-- Add these to allow quick moving between prompts
{ key = 'UpArrow', mods = 'SHIFT', action = act.ScrollToPrompt(-1) },
{ key = 'DownArrow', mods = 'SHIFT', action = act.ScrollToPrompt(1) },
--
{ key = 'RightArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize { 'Right', 1 } },
{ key = 'UpArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Up' },
{ key = 'UpArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize { 'Up', 1 } },
{ key = 'DownArrow', mods = 'SHIFT|CTRL', action = act.ActivatePaneDirection 'Down' },
{ key = 'DownArrow', mods = 'SHIFT|ALT|CTRL', action = act.AdjustPaneSize { 'Down', 1 } },
{ key = 'Insert', mods = 'SHIFT', action = act.PasteFrom 'PrimarySelection' },
{ key = 'Insert', mods = 'CTRL', action = act.CopyTo 'PrimarySelection' },
{ key = 'F11', mods = 'NONE', action = act.ToggleFullScreen },
{ key = 'Copy', mods = 'NONE', action = act.CopyTo 'Clipboard' },
{ key = 'Paste', mods = 'NONE', action = act.PasteFrom 'Clipboard' },
}
-- Mousing bindings
mouse_bindings = {
{
event = { Down = { streak = 3, button = 'Left' } },
action = wezterm.action.SelectTextAtMouseCursor 'SemanticZone',
mods = 'NONE',
},
}
wezterm.on("toggle-opacity", function(window, pane)
local overrides = window:get_config_overrides() or {}
if not overrides.window_background_opacity then
overrides.window_background_opacity = 1.0;
else
overrides.window_background_opacity = nil
end
window:set_config_overrides(overrides)
end)
--- Default config settings
config.scrollback_lines = 7000
config.adjust_window_size_when_changing_font_size = false
config.hide_tab_bar_if_only_one_tab = true
config.window_decorations = "RESIZE"
config.font = wezterm.font{family = "JetBrains Mono", weight = 'Bold'}
config.warn_about_missing_glyphs = false
config.window_background_opacity = 0.8
config.launch_menu = launch_menu
config.default_cursor_style = 'BlinkingBar'
config.disable_default_key_bindings = true
config.keys = keys
config.mouse_bindings = mouse_bindings
return config