-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.wezterm.lua
127 lines (117 loc) · 4.28 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
-- Load wezterm API and get config object
local wezterm = require("wezterm")
local config = wezterm.config_builder()
-------------------- appearance --------------------
-- config.default_cursor_style = 'BlinkingBlock'
config.enable_scroll_bar = true
-- config.color_scheme = "tokyonight_moon"
config.color_scheme = "Catppuccin Mocha"
-- window transparency
config.window_background_opacity = 0.9
config.macos_window_background_blur = 10
-- config.background = {
-- {
-- source = {
-- File = '~/path/to/wallpaper.png',
-- },
-- }
-- }
config.window_decorations = "TITLE | RESIZE"
config.use_fancy_tab_bar = false
config.enable_tab_bar = true
config.show_tab_index_in_tab_bar = true
config.hide_tab_bar_if_only_one_tab = false
config.inactive_pane_hsb = {
saturation = 0.9,
brightness = 0.8,
}
-- font and window
-- config.font = wezterm.font("CaskaydiaCove Nerd Font")
config.font = wezterm.font("JetBrainsMono Nerd Font")
config.font_size = 13
config.initial_cols = 130
config.initial_rows = 35
-- default shell
config.set_environment_variables = {
-- COMSPEC = 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe',
COMSPEC = "zsh",
}
-------------------- utils --------------------
local function is_found(str, pattern)
return string.find(str, pattern) ~= nil
end
local function what_platform()
local is_win = is_found(wezterm.target_triple, "windows")
local is_linux = is_found(wezterm.target_triple, "linux")
local is_mac = is_found(wezterm.target_triple, "apple")
local os = is_win and "windows" or is_linux and "linux" or is_mac and "mac" or "unknown"
return {
os = os,
is_win = is_win,
is_linux = is_linux,
is_mac = is_mac,
}
end
-------------------- keybindings --------------------
local mod = {}
local platform = what_platform()
if platform.is_mac then
mod.SUPER = "SUPER"
mod.SUPER_REV = "SUPER|CTRL"
elseif platform.is_win or platform.is_linux then
mod.SUPER = "ALT" -- to not conflict with Windows key shortcuts
mod.SUPER_REV = "ALT|CTRL"
end
local act = wezterm.action
config.leader = { key = "Space", mods = mod.SUPER_REV, timeout_milliseconds = 1000 }
config.keys = {
{ key = "q", mods = "LEADER", action = act.QuitApplication },
{ key = "F11", mods = "NONE", action = act.ToggleFullScreen },
-- Pane
{ key = "h", mods = mod.SUPER, action = act.SplitHorizontal({ domain = "CurrentPaneDomain" }) },
{ key = "v", mods = mod.SUPER, action = act.SplitVertical({ domain = "CurrentPaneDomain" }) },
{ key = "q", mods = mod.SUPER, action = act.CloseCurrentPane({ confirm = false }) },
{ key = "z", mods = mod.SUPER, action = act.TogglePaneZoomState },
{ key = "LeftArrow", mods = mod.SUPER, action = act.ActivatePaneDirection("Left") },
{ key = "RightArrow", mods = mod.SUPER, action = act.ActivatePaneDirection("Right") },
{ key = "UpArrow", mods = mod.SUPER, action = act.ActivatePaneDirection("Up") },
{ key = "DownArrow", mods = mod.SUPER, action = act.ActivatePaneDirection("Down") },
-- Tab
{ key = "LeftArrow", mods = "CTRL|SHIFT", action = act.ActivateTabRelative(-1) },
{ key = "RightArrow", mods = "CTRL|SHIFT", action = act.ActivateTabRelative(1) },
{ key = "[", mods = mod.SUPER, action = act.ActivateTabRelative(-1) },
{ key = "]", mods = mod.SUPER, action = act.ActivateTabRelative(1) },
{ key = "[", mods = mod.SUPER_REV, action = act.MoveTabRelative(-1) },
{ key = "]", mods = mod.SUPER_REV, action = act.MoveTabRelative(1) },
-- CTRL+SHIFT+T to create new Tab.
{ key = "t", mods = "CTRL|SHIFT", action = act.SpawnTab("DefaultDomain") },
-- CTRL+SHIFT+W to close current Tab.
{ key = "w", mods = "CTRL|SHIFT", action = act.CloseCurrentTab({ confirm = false }) },
-- CTRL+SHIFT+N to create new window.
{ key = "n", mods = "CTRL|SHIFT", action = act.SpawnWindow },
}
-- Quickly jump between tabs
for i = 1, 9 do
table.insert(config.keys, {
key = tostring(i),
mods = mod.SUPER,
action = act.ActivateTab(i - 1),
})
end
-------------------- mouse actions --------------------
config.mouse_bindings = {
-- copy the selection
{
event = { Up = { streak = 1, button = "Left" } },
mods = mod.SUPER,
action = act.CompleteSelection("ClipboardAndPrimarySelection"),
},
-- Open HyperLink
{
event = { Up = { streak = 1, button = "Left" } },
mods = "CTRL",
action = act.OpenLinkAtMouseCursor,
},
}
-- and finally, return the configuration to wezterm
return config