-
Notifications
You must be signed in to change notification settings - Fork 0
/
wezterm.lua
124 lines (116 loc) · 3.99 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
local wezterm = require("wezterm")
local act = wezterm.action
local platform = wezterm.target_triple
-- config --
local M = {}
M.disable_default_key_bindings = true
M.leader = { key = " ", mods = "CTRL" }
M = wezterm.config_builder()
M.tab_bar_at_bottom = true
M.hide_tab_bar_if_only_one_tab = true
M.initial_cols = 155
M.initial_rows = 44
M.font_size = 13
M.front_end = "WebGpu"
M.color_scheme = "Dracula"
local mod = {}
mod.SUPER = "SUPER"
mod.SUPER_REV = "SUPER|CTRL"
mod.CTRL = "CTRL"
-- keymaps --
local keys = {
{ key = "Tab", mods = mod.CTRL, action = act.ActivateTabRelative(1) },
{ key = [[\]], mods = mod.SUPER, action = act({ SplitVertical = { domain = "CurrentPaneDomain" } }) },
{ key = [[\]], mods = mod.SUPER_REV, action = act({ SplitHorizontal = { domain = "CurrentPaneDomain" } }) },
{ key = "h", mods = mod.SUPER, action = act({ ActivatePaneDirection = "Left" }) },
{ key = "j", mods = mod.SUPER, action = act({ ActivatePaneDirection = "Down" }) },
{ key = "k", mods = mod.SUPER, action = act({ ActivatePaneDirection = "Up" }) },
{ key = "l", mods = mod.SUPER, action = act({ ActivatePaneDirection = "Right" }) },
{ key = "p", mods = mod.SUPER, action = act.ActivateCommandPalette },
{ key = "f", mods = mod.SUPER, action = act.Search({ CaseInSensitiveString = "" }) },
{
key = "u",
mods = mod.SUPER,
action = wezterm.action.QuickSelectArgs({
label = "open url",
patterns = {
"\\((https?://\\S+)\\)",
"\\[(https?://\\S+)\\]",
"\\{(https?://\\S+)\\}",
"<(https?://\\S+)>",
"\\bhttps?://\\S+[)/a-zA-Z0-9-]+",
},
action = wezterm.action_callback(function(window, pane)
local url = window:get_selection_text_for_pane(pane)
wezterm.log_info("opening: " .. url)
wezterm.open_with(url)
end),
}),
},
{ key = "t", mods = mod.SUPER, action = act.SpawnTab("DefaultDomain") },
{ key = "c", mods = mod.SUPER, action = act.CopyTo("Clipboard") },
{ key = "v", mods = mod.SUPER, action = act.PasteFrom("Clipboard") },
{ key = "w", mods = mod.SUPER, action = act.CloseCurrentPane({ confirm = false }) },
{ key = "[", mods = mod.SUPER, action = act.ActivateTabRelative(-1) },
{ key = "]", mods = mod.SUPER, action = act.ActivateTabRelative(1) },
{ key = "n", mods = mod.SUPER, action = act.SpawnWindow },
{ key = "i", mods = mod.SUPER, action = act.QuickSelect },
{ key = "e", mods = mod.SUPER, action = act.ActivateCopyMode },
{
key = "k",
mods = mod.SUPER_REV,
action = act.Multiple({ act.ClearScrollback("ScrollbackAndViewport"), act.SendKey({ key = "L", mods = "CTRL" }) }),
},
-- resizes fonts
{
key = "f",
mods = "LEADER",
action = act.ActivateKeyTable({
name = "resize_font",
one_shot = false,
timemout_miliseconds = 1000,
}),
},
-- resize panes
{
key = "p",
mods = "LEADER",
action = act.ActivateKeyTable({
name = "resize_pane",
one_shot = false,
timemout_miliseconds = 1000,
}),
},
}
for i = 1, 8 do
table.insert(keys, { key = tostring(i), mods = mod.SUPER, action = act.ActivateTab(i - 1) })
end
local key_tables = {
resize_font = {
{ key = "k", action = act.IncreaseFontSize },
{ key = "j", action = act.DecreaseFontSize },
{ key = "r", action = act.ResetFontSize },
{ key = "Escape", action = "PopKeyTable" },
{ key = "q", action = "PopKeyTable" },
},
resize_pane = {
{ key = "k", action = act.AdjustPaneSize({ "Up", 1 }) },
{ key = "j", action = act.AdjustPaneSize({ "Down", 1 }) },
{ key = "h", action = act.AdjustPaneSize({ "Left", 1 }) },
{ key = "l", action = act.AdjustPaneSize({ "Right", 1 }) },
{ key = "Escape", action = "PopKeyTable" },
{ key = "q", action = "PopKeyTable" },
},
}
M.keys = keys
M.key_tables = key_tables
-- platform --
if string.find(platform, "windows") then
M.default_prog = { "powershell.exe" }
elseif string.find(platform, "darwin") then
M.font = wezterm.font_with_fallback({
"JetBrains Mono",
"PingFang SC",
})
end
return M