-
Notifications
You must be signed in to change notification settings - Fork 0
/
.wezterm.lua
390 lines (369 loc) · 14.1 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
local wezterm = require 'wezterm'
local act = wezterm.action
wezterm.on('format-window-title', function(tab, pane, tabs, panes, config)
local zoomed = ''
if tab.active_pane.is_zoomed then
zoomed = '[Z] '
end
local index = ''
if #tabs > 1 then
-- Get the current user
local username = os.getenv("USER") or os.getenv("USERNAME") or "unknown"
-- Get the hostname
local hostname = io.popen("hostname"):read("*l") or "unknown"
index = string.format('%s@%s:', username, hostname)
end
return zoomed .. index .. tab.active_pane.title
end)
function tab_title(tab_info)
local title = tab_info.tab_title
-- if the tab title is explicitly set, take that
if title and #title > 0 then
return title
end
-- Otherwise, use the title from the active pane
-- in that tab
return tab_info.active_pane.title
end
wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width)
local title = tab_title(tab)
local pane = tab.active_pane
local active_symbol = "📁" -- Default symbol for directory
-- Check if the pane title contains 'nano' to change the symbol
if pane.title:match("nano") or tab.active_pane.title:match("vi") then
active_symbol = "✏️" -- Symbol for editing with nano
end
if tab.is_active then
return {
{ Background = { Color = '#7882d1' } },
{ Text = ' ' .. active_symbol .. ' ' .. title .. ' ' },
}
elseif hover then
return {
{ Background = { Color = 'gray' } },
{ Text = ' 📂 ' .. title .. ' ' },
}
else
return ' ' .. title .. ' '
end
end)
mb = {
}
for i = 1,99,1
do
table.insert(mb,
{
event = { Down = { streak = i, button = 'Middle' } },
mods = 'NONE',
action = act.PasteFrom("PrimarySelection")
})
table.insert(mb, {
event = { Down = { streak = i, button = 'Right' } },
mods = 'NONE',
action = wezterm.action_callback(function(window, pane)
local has_selection = window:get_selection_text_for_pane(pane) ~= ''
if has_selection then
window:perform_action(
act.CopyTo 'ClipboardAndPrimarySelection',
pane
)
window:perform_action(act.ClearSelection, pane)
else
window:perform_action(act.PasteFrom("PrimarySelection"), pane)
end
end),
})
end
return {
disable_default_key_bindings = true,
pane_focus_follows_mouse = false,
mouse_bindings = mb,
initial_cols = 160,
initial_rows = 48,
-- leader = { key = 'VoidSymbol', timeout_milliseconds = 1000 },
keys = {
-- {
-- key = 'c',
-- mods = 'CTRL|SHIFT',
-- action = wezterm.action.SpawnCommandInNewTab {
-- args = { 'zsh' },
-- cwd = '~'
-- },
-- },
{
key = 'PageUp',
mods = 'SHIFT',
action = act.ScrollByPage(-1),
},
{
key = 'x',
mods = 'CTRL|SHIFT',
action = wezterm.action.CloseCurrentPane { confirm = true },
},
{
key = 'PageDown',
mods = 'SHIFT',
action = act.ScrollByPage(1),
},
{
key = 'v',
mods = 'CTRL|SHIFT',
action = act.PasteFrom("Clipboard"),
},
{
key = 'c',
mods = 'CTRL|SHIFT',
action = act.CopyTo("Clipboard"),
},
{
key = 't',
mods = 'CTRL|SHIFT',
action = wezterm.action.SpawnCommandInNewTab {
args = { 'zsh' },
cwd = '~'
},
},
{
key = 'f',
mods = 'CTRL',
action = wezterm.action.TogglePaneZoomState,
},
{ key = 'f', mods = 'SHIFT|CTRL', action = act.Search 'CurrentSelectionOrEmptyString' },
{
key = 'r',
mods = 'CTRL|SHIFT',
action = wezterm.action.ReloadConfiguration,
},
-- {
-- key = 'p',
-- mods = 'LEADER',
-- action = act.ActivateTabRelative(-1),
-- },
-- {
-- key = 'n',
-- mods = 'LEADER',
-- action = act.ActivateTabRelative(1),
-- },
{
key = 'Tab',
mods = 'CTRL|SHIFT',
action = act.ActivateTabRelative(-1),
},
{
key = 'Tab',
mods = 'CTRL',
action = act.ActivateTabRelative(1),
},
{
key = 'E',
mods = 'CTRL|SHIFT',
action = act.PromptInputLine {
description = 'Enter new name for tab',
action = wezterm.action_callback(function(window, pane, line)
-- line will be `nil` if they hit escape without entering anything
-- An empty string if they just hit enter
-- Or the actual line of text they wrote
if line then
window:active_tab():set_title(line)
end
end),
},
},
{
key = '2',
mods = 'CTRL',
action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
},
{
key = '2',
mods = 'LEADER',
action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
},
{
key = '5',
mods = 'CTRL',
action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
},
{
key = '5',
mods = 'LEADER',
action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
},
{
key = 'LeftArrow',
mods = 'CTRL',
action = act.ActivatePaneDirection 'Left',
},
{
key = 'RightArrow',
mods = 'CTRL',
action = act.ActivatePaneDirection 'Right',
},
{
key = 'UpArrow',
mods = 'CTRL',
action = act.ActivatePaneDirection 'Up',
},
{
key = 'DownArrow',
mods = 'CTRL',
action = act.ActivatePaneDirection 'Down',
}
},
key_tables = {
copy_mode = {
{ key = 'Tab', mods = 'NONE', action = act.CopyMode 'MoveForwardWord' },
{ key = 'Tab', mods = 'SHIFT', action = act.CopyMode 'MoveBackwardWord' },
{ key = 'Enter', mods = 'NONE', action = act.CopyMode 'MoveToStartOfNextLine' },
{ key = 'Escape', mods = 'NONE', action = act.CopyMode 'Close' },
{ key = 'Space', mods = 'NONE', action = act.CopyMode{ SetSelectionMode = 'Cell' } },
{ key = '$', mods = 'NONE', action = act.CopyMode 'MoveToEndOfLineContent' },
{ key = '$', mods = 'SHIFT', action = act.CopyMode 'MoveToEndOfLineContent' },
{ key = ',', mods = 'NONE', action = act.CopyMode 'JumpReverse' },
{ key = '0', mods = 'NONE', action = act.CopyMode 'MoveToStartOfLine' },
{ key = ';', mods = 'NONE', action = act.CopyMode 'JumpAgain' },
{ key = 'F', mods = 'NONE', action = act.CopyMode{ JumpBackward = { prev_char = false } } },
{ key = 'F', mods = 'SHIFT', action = act.CopyMode{ JumpBackward = { prev_char = false } } },
{ key = 'G', mods = 'NONE', action = act.CopyMode 'MoveToScrollbackBottom' },
{ key = 'G', mods = 'SHIFT', action = act.CopyMode 'MoveToScrollbackBottom' },
{ key = 'H', mods = 'NONE', action = act.CopyMode 'MoveToViewportTop' },
{ key = 'H', mods = 'SHIFT', action = act.CopyMode 'MoveToViewportTop' },
{ key = 'L', mods = 'NONE', action = act.CopyMode 'MoveToViewportBottom' },
{ key = 'L', mods = 'SHIFT', action = act.CopyMode 'MoveToViewportBottom' },
{ key = 'M', mods = 'NONE', action = act.CopyMode 'MoveToViewportMiddle' },
{ key = 'M', mods = 'SHIFT', action = act.CopyMode 'MoveToViewportMiddle' },
{ key = 'O', mods = 'NONE', action = act.CopyMode 'MoveToSelectionOtherEndHoriz' },
{ key = 'O', mods = 'SHIFT', action = act.CopyMode 'MoveToSelectionOtherEndHoriz' },
{ key = 'T', mods = 'NONE', action = act.CopyMode{ JumpBackward = { prev_char = true } } },
{ key = 'T', mods = 'SHIFT', action = act.CopyMode{ JumpBackward = { prev_char = true } } },
{ key = 'V', mods = 'NONE', action = act.CopyMode{ SetSelectionMode = 'Line' } },
{ key = 'V', mods = 'SHIFT', action = act.CopyMode{ SetSelectionMode = 'Line' } },
{ key = '^', mods = 'NONE', action = act.CopyMode 'MoveToStartOfLineContent' },
{ key = '^', mods = 'SHIFT', action = act.CopyMode 'MoveToStartOfLineContent' },
{ key = 'b', mods = 'NONE', action = act.CopyMode 'MoveBackwardWord' },
{ key = 'b', mods = 'ALT', action = act.CopyMode 'MoveBackwardWord' },
{ key = 'b', mods = 'CTRL', action = act.CopyMode 'PageUp' },
{ key = 'c', mods = 'CTRL', action = act.CopyMode 'Close' },
{ key = 'd', mods = 'CTRL', action = act.CopyMode{ MoveByPage = (0.5) } },
{ key = 'e', mods = 'NONE', action = act.CopyMode 'MoveForwardWordEnd' },
{ key = 'f', mods = 'NONE', action = act.CopyMode{ JumpForward = { prev_char = false } } },
{ key = 'f', mods = 'ALT', action = act.CopyMode 'MoveForwardWord' },
{ key = 'f', mods = 'CTRL', action = act.CopyMode 'PageDown' },
{ key = 'g', mods = 'NONE', action = act.CopyMode 'MoveToScrollbackTop' },
{ key = 'g', mods = 'CTRL', action = act.CopyMode 'Close' },
{ key = 'h', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
{ key = 'j', mods = 'NONE', action = act.CopyMode 'MoveDown' },
{ key = 'k', mods = 'NONE', action = act.CopyMode 'MoveUp' },
{ key = 'l', mods = 'NONE', action = act.CopyMode 'MoveRight' },
{ key = 'm', mods = 'ALT', action = act.CopyMode 'MoveToStartOfLineContent' },
{ key = 'o', mods = 'NONE', action = act.CopyMode 'MoveToSelectionOtherEnd' },
{ key = 'q', mods = 'NONE', action = act.CopyMode 'Close' },
{ key = 't', mods = 'NONE', action = act.CopyMode{ JumpForward = { prev_char = true } } },
{ key = 'u', mods = 'CTRL', action = act.CopyMode{ MoveByPage = (-0.5) } },
{ key = 'v', mods = 'NONE', action = act.CopyMode{ SetSelectionMode = 'Cell' } },
{ key = 'v', mods = 'CTRL', action = act.CopyMode{ SetSelectionMode = 'Block' } },
{ key = 'w', mods = 'NONE', action = act.CopyMode 'MoveForwardWord' },
{ key = 'y', mods = 'NONE', action = act.Multiple{ { CopyTo = 'ClipboardAndPrimarySelection' }, { CopyMode = 'Close' } } },
{ key = 'PageUp', mods = 'NONE', action = act.CopyMode 'PageUp' },
{ key = 'PageDown', mods = 'NONE', action = act.CopyMode 'PageDown' },
{ key = 'End', mods = 'NONE', action = act.CopyMode 'MoveToEndOfLineContent' },
{ key = 'Home', mods = 'NONE', action = act.CopyMode 'MoveToStartOfLine' },
{ key = 'LeftArrow', mods = 'NONE', action = act.CopyMode 'MoveLeft' },
{ key = 'LeftArrow', mods = 'ALT', action = act.CopyMode 'MoveBackwardWord' },
{ key = 'RightArrow', mods = 'NONE', action = act.CopyMode 'MoveRight' },
{ key = 'RightArrow', mods = 'ALT', action = act.CopyMode 'MoveForwardWord' },
{ key = 'UpArrow', mods = 'NONE', action = act.CopyMode 'MoveUp' },
{ key = 'DownArrow', mods = 'NONE', action = act.CopyMode 'MoveDown' },
},
search_mode = {
{ key = 'Enter', mods = 'NONE', action = act.CopyMode 'PriorMatch' },
{ key = 'Escape', mods = 'NONE', action = act.CopyMode 'Close' },
{ key = 'n', mods = 'CTRL', action = act.CopyMode 'NextMatch' },
{ key = 'p', mods = 'CTRL', action = act.CopyMode 'PriorMatch' },
{ key = 'r', mods = 'CTRL', action = act.CopyMode 'CycleMatchType' },
{ key = 'u', mods = 'CTRL', action = act.CopyMode 'ClearPattern' },
{ key = 'PageUp', mods = 'NONE', action = act.CopyMode 'PriorMatchPage' },
{ key = 'PageDown', mods = 'NONE', action = act.CopyMode 'NextMatchPage' },
{ key = 'UpArrow', mods = 'NONE', action = act.CopyMode 'PriorMatch' },
{ key = 'DownArrow', mods = 'NONE', action = act.CopyMode 'NextMatch' },
},
},
window_padding = {
left = 2,
right = 2,
top = 0,
bottom = 0,
},
window_frame = {
border_left_width = '0.5cell',
border_right_width = '0.5cell',
font = wezterm.font { family = 'Roboto', weight = 'Bold' },
font_size = 12.0,
},
tab_bar_at_bottom = true,
use_fancy_tab_bar = true,
font = wezterm.font_with_fallback({"JetBrainsMono Nerd Font Mono", "Courier 10 Pitch"}),
font_size = 12,
enable_scroll_bar = true,
show_tab_index_in_tab_bar = false,
animation_fps = 60,
color_scheme = "CustomScheme",
color_schemes = {
["CustomScheme"] = {
foreground = "#FFFFFF", -- [Foreground]
background = "#19191f", -- [Background]
cursor_bg = "#CCCCCC", -- Default cursor color
cursor_border = "#CCCCCC", -- Cursor border color
cursor_fg = "#131316", -- Text color when cursor is inverted
selection_fg = "#131316", -- Text color when selected
selection_bg = "#FFFFFF", -- Background color when selected
ansi = {
"#232627", -- [Color0]
"#ED1515", -- [Color1]
"#11D116", -- [Color2]
"#F67400", -- [Color3]
"#1D99F3", -- [Color4]
"#9B59B6", -- [Color5]
"#1ABC9C", -- [Color6]
"#FCFCFC", -- [Color7]
},
brights = {
"#D87700", -- [Color0Intense]
"#C0392B", -- [Color1Intense]
"#1CDC9A", -- [Color2Intense]
"#FDBC4B", -- [Color3Intense]
"#3DAEE9", -- [Color4Intense]
"#8E44AD", -- [Color5Intense]
"#16A085", -- [Color6Intense]
"#FFFFFF", -- [Color7Intense]
},
indexed = {
[16] = "#31363B", -- [BackgroundFaint]
[17] = "#FFCC00", -- Any other extra color you may want to add (optional)
},
tab_bar = {
background = "#131316", -- Tab bar background color
active_tab = {
bg_color = "#31363B", -- Active tab background color
fg_color = "#FFFFFF", -- Active tab foreground color
},
inactive_tab = {
bg_color = "#232627", -- Inactive tab background color
fg_color = "#C0C0C0", -- Inactive tab foreground color
},
inactive_tab_hover = {
bg_color = "#3D3F43", -- Inactive tab hover background color
fg_color = "#D0D0D0", -- Inactive tab hover foreground color
},
new_tab = {
bg_color = "#131316", -- New tab button background color
fg_color = "#FFFFFF", -- New tab button foreground color
},
new_tab_hover = {
bg_color = "#3D3F43", -- New tab hover background color
fg_color = "#D0D0D0", -- New tab hover foreground color
},
},
}
},
}