-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_wezterm.lua
More file actions
280 lines (264 loc) · 7.1 KB
/
Copy pathdot_wezterm.lua
File metadata and controls
280 lines (264 loc) · 7.1 KB
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
local wezterm = require("wezterm")
local act = wezterm.action
local config = wezterm.config_builder()
-- main config
config.automatically_reload_config = true
config.max_fps = 60
config.default_cursor_style = "BlinkingBlock"
config.animation_fps = 1
config.cursor_blink_rate = 0
config.hide_mouse_cursor_when_typing = false
config.term = "xterm-256color"
config.enable_kitty_keyboard = false -- kinda forced because escape keys dont send anything while kitty is enabled
config.font = wezterm.font("CaskaydiaCove NFM")
config.custom_block_glyphs = false
config.cell_width = 1
-- blur handled by windhawk
-- transparency can be changed by ctrl + shift + o
config.window_background_opacity = 0.75
config.font_size = 11.5
-- config.enable_scroll_bar = true
config.front_end = "WebGpu"
config.webgpu_power_preference = "LowPower"
config.swallow_mouse_click_on_pane_focus = true
config.default_prog = { "pwsh", "-NoLogo" }
-- config.default_prog = { "nu" }
config.initial_cols = 80
if wezterm.target_triple:find("linux") then
config.window_decorations = "NONE"
else
if wezterm.target_triple:find("windows") then
config.webgpu_preferred_adapter = wezterm.gui.enumerate_gpus()[1]
config.win32_system_backdrop = "Disable"
end
config.window_decorations = "NONE | RESIZE"
end
config.window_padding = {
left = 8,
right = 8,
top = 8,
bottom = 5,
}
-- tabs
config.hide_tab_bar_if_only_one_tab = false
config.use_fancy_tab_bar = false
config.tab_bar_at_bottom = true
config.show_new_tab_button_in_tab_bar = false
config.tab_max_width = 100
config.show_tab_index_in_tab_bar = true
-- keymaps
config.keys = {
{
key = "I",
mods = "CTRL|SHIFT",
action = wezterm.action.SplitPane({
direction = "Up",
size = { Percent = 50 },
}),
},
{
key = "J",
mods = "CTRL|SHIFT",
action = wezterm.action.SplitPane({
direction = "Left",
size = { Percent = 50 },
}),
},
{
key = "L",
mods = "CTRL|SHIFT",
action = wezterm.action.SplitPane({
direction = "Right",
size = { Percent = 50 },
}),
},
{
key = "K",
mods = "CTRL|SHIFT",
action = wezterm.action.SplitPane({
direction = "Down",
size = { Percent = 50 },
}),
},
{
key = "D",
mods = "CTRL|SHIFT",
action = act.ShowDebugOverlay
},
{
key = "O",
mods = "CTRL|SHIFT",
action = wezterm.action_callback(function(window, _)
local overrides = window:get_config_overrides() or {}
if overrides.window_background_opacity == nil then
overrides.window_background_opacity = 0.8
end
overrides.window_background_opacity = overrides.window_background_opacity - 0.125
if overrides.window_background_opacity <= 0 then
overrides.window_background_opacity = 1
end
window:set_config_overrides(overrides)
end),
},
{
key = "t",
mods = "CTRL",
action = act.SpawnTab "CurrentPaneDomain",
},
{
key = "w",
mods = "CTRL",
action = wezterm.action.CloseCurrentPane { confirm = true },
},
{
key = "e",
mods = "ALT",
action = act.PromptInputLine {
description = "Enter name for tab",
initial_value = "",
action = wezterm.action_callback(function(window, _, line)
if line then
window:active_tab():set_title(line)
end
end),
},
},
{
key = "E",
mods = "ALT|SHIFT",
action = act.PromptInputLine {
description = "Enter name for new workspace",
action = wezterm.action_callback(function(window, pane, line)
if line then
window:perform_action(
act.SwitchToWorkspace { name = line },
pane
)
end
end),
},
},
{ key = "]", mods = "CTRL", action = wezterm.action { ActivatePaneDirection = "Next" } },
{ key = "[", mods = "CTRL", action = wezterm.action { ActivatePaneDirection = "Prev" } },
-- { key = "k", mods = "CTRL", action = act.ShowLauncher },
{ key = "{", mods = "CTRL|SHIFT", action = act.SwitchWorkspaceRelative(-1) },
{ key = "}", mods = "CTRL|SHIFT", action = act.SwitchWorkspaceRelative(1) },
{ key = "PageUp", mods = "CTRL", action = act.SendKey { key = "PageUp", mods = "CTRL" } },
{ key = "PageDown", mods = "CTRL", action = act.SendKey { key = "PageDown", mods = "CTRL" } },
{ key = ".", mods = "CTRL", action = act.MoveTabRelative(1) },
{ key = ",", mods = "CTRL", action = act.MoveTabRelative(-1) },
{ key = "T", mods = "CTRL|SHIFT", action = act.DisableDefaultAssignment },
{ key = "F", mods = "CTRL|SHIFT", action = act.DisableDefaultAssignment },
{ key = "Enter", mods = "ALT", action = act.DisableDefaultAssignment },
}
-- colors
config.color_scheme = "nord"
config.colors = {
background = "#2e3440",
cursor_border = "#5e81ac",
cursor_bg = "#d8dee9",
tab_bar = {
-- background = "rgb(46, 52, 64 / 75%)", -- only used if tab is at top
background = "rgb(0,0,0/0%)", -- only used if tab is at bottom
active_tab = {
bg_color = "#88c0d0",
fg_color = "hsl(0,0,0/0)",
intensity = "Normal",
underline = "None",
italic = false,
strikethrough = false,
},
inactive_tab = {
bg_color = "hsl(0,0,0/0)",
fg_color = "#88c0d0",
intensity = "Normal",
underline = "None",
italic = false,
strikethrough = false,
},
},
}
-- Plugins
local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez")
local function weztermOrWorkspace()
local active_workspace = wezterm.mux.get_active_workspace()
if active_workspace == "default" then
return " wezterm "
else
return " " .. active_workspace .. " "
end
end
local function get_process_title(tab)
local title = tab.tab_title
if title and #title > 0 then
return title .. " "
end
local active_pane_title = tab.active_pane.title
if wezterm.target_triple:find("windows") then
--- we need to make some changes to make the title nicer at times
if active_pane_title:find("Administrator:") then
active_pane_title = active_pane_title:gsub("Administrator: ", "")
end
if active_pane_title:find("clink") then
-- problem is that for some reason, title becomes `Administrator: hx <file> - "<clink path>\clink.bat" inject --autorun`
-- so we need to remove the clink part
active_pane_title = active_pane_title:gsub('- ".*clink.bat".*', "")
end
end
return active_pane_title .. " "
end
tabline.setup({
options = {
icons_enabled = true,
theme = "nord",
tabs_enabled = true,
theme_overrides = {
normal_mode = {
a = { bg = "rgb(136, 192, 208)" },
c = { bg = "rgba(46, 52, 64, 0)" }
},
copy_mode = { c = { bg = "rgba(46, 52, 64, 0)" } },
tab = {
active = { fg = "#2e3440", bg = "#88c0d0" },
inactive = { fg = "#eceff4", bg = "rgba(59, 66, 82, 0)" },
inactive_hover = { fg = "#b48ead", bg = "rgba(59, 66, 82, 0)" },
}
},
},
sections = {
tabline_a = { weztermOrWorkspace },
tabline_b = {},
tabline_c = {},
tab_active = {
" [",
{
"index",
padding = 0
},
"] ",
get_process_title,
{
"zoomed",
padding = 0
}
},
tab_inactive = {
{ Background = { Color = "#3b4252" } },
" [",
{
"index",
padding = 0
},
"] ",
get_process_title,
{
"zoomed",
padding = 0
}
},
tabline_x = {},
tabline_y = {},
tabline_z = {},
},
})
return config