最後活躍 1 month ago

WezTerm 主题(兼容 Linux 和 Window)

修訂 a6a0f59430b7193ba17bf49a1652b2c6cd9995ef

wezterm.lua 原始檔案
1local wezterm = require 'wezterm'
2local act = wezterm.action
3local target = wezterm.target_triple
4
5local drag_mod = "SUPER"
6local default_prog = nil
7
8-- Windows 特殊处理
9if target:find("windows") then
10 drag_mod = "ALT"
11
12 -- 只在 Windows 使用 PowerShell 7
13 default_prog = {
14 "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
15 "-NoLogo",
16 "-ExecutionPolicy", "RemoteSigned"
17 }
18end
19
20return {
21
22 -- 设置底座
23 default_prog = default_prog,
24
25 set_environment_variables = {
26 TERM = "xterm-256color",
27 },
28
29 keys = {
30 -- 用 Ctrl + W 关闭当前 pane
31 {
32 key = 'w',
33 mods = 'CTRL',
34 action = wezterm.action.CloseCurrentPane { confirm = true },
35 },
36 -- 新建 Tab(iTerm2 风格)
37 {
38 key = "t",
39 mods = "CTRL|SHIFT",
40 action = wezterm.action.SpawnTab("CurrentPaneDomain"),
41 -- action = hud("New Tab", act.SpawnTab("CurrentPaneDomain")),
42 },
43
44 -- 关闭 Tab
45 --[[
46 {
47 key = "w",
48 mods = "CTRL|SHIFT",
49 action = wezterm.action.CloseCurrentTab({ confirm = true }),
50 },
51 ]]
52
53 -- 下一个 Tab
54 {
55 key = "]",
56 mods = "CTRL|SHIFT",
57 action = wezterm.action.ActivateTabRelative(1),
58 -- action = hud("Next Tab",
59 -- act.ActivateTabRelative(1)
60 -- ),
61 },
62
63 -- 上一个 Tab
64 {
65 key = "[",
66 mods = "CTRL|SHIFT",
67 action = wezterm.action.ActivateTabRelative(-1),
68 },
69
70 -- 垂直分屏(像 Sublime)
71 --[[
72 {
73 key = "d",
74 mods = "CTRL|SHIFT",
75 action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
76 -- action = hud("Split Horizontal",
77 -- act.SplitHorizontal({ domain = "CurrentPaneDomain" })
78 -- ),
79 },
80 ]]
81
82 -- 水平分屏
83 --[[
84 {
85 key = "D",
86 mods = "CTRL|SHIFT",
87 action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }),
88 },
89 ]]
90 },
91
92 -- Ubuntu + GNOME 更像 iTerm2
93 window_frame = {
94 font_size = 11,
95 },
96
97 -- 像 macOS iTerm2 一样拖动窗口
98 mouse_bindings = {
99 {
100 event = { Down = { streak = 1, button = "Left" } },
101 mods = drag_mod,
102 action = act.StartWindowDrag,
103 },
104 },
105
106 -- GPU 渲染
107 front_end = "WebGpu",
108
109 -- 字体(非常接近 macOS 观感)
110 font = wezterm.font_with_fallback({
111 "JetBrains Mono",
112 "Fira Code",
113 "Noto Sans Mono",
114 "JetBrainsMono Nerd Font",
115 }),
116
117 font_size = 12.5,
118 line_height = 1.15,
119
120 -- macOS 风格窗口
121 window_decorations = "RESIZE",
122 window_background_opacity = 0.93,
123 text_background_opacity = 0.93,
124
125 -- 光标(Sublime 风格)
126 default_cursor_style = "BlinkingBar",
127 cursor_blink_rate = 600,
128
129 -- 关闭顶部 tab bar(更像 iTerm2)
130 enable_tab_bar = false,
131
132 -- padding 像 macOS 终端
133 window_padding = {
134 left = 12,
135 right = 12,
136 top = 10,
137 bottom = 10,
138 },
139
140 -- 颜色主题(iTerm2 + Sublime 混合)
141 colors = {
142 foreground = "#E8E8E8",
143 background = "#1E1F22",
144
145 cursor_bg = "#A6E22E",
146 cursor_fg = "#1E1F22",
147 cursor_border = "#A6E22E",
148
149 selection_fg = "#FFFFFF",
150 selection_bg = "#44475A",
151
152 ansi = {
153 "#2D2A2E",
154 "#F92672",
155 "#A6E22E",
156 "#E6DB74",
157 "#66D9EF",
158 "#AE81FF",
159 "#38CCD1",
160 "#F8F8F2",
161 },
162
163 brights = {
164 "#75715E",
165 "#FF6188",
166 "#B6E354",
167 "#FFD866",
168 "#78DCE8",
169 "#AB9DF2",
170 "#3BC9DB",
171 "#FFFFFF",
172 },
173
174 -- iTerm2 风格 split
175 split = "#44475A",
176 },
177
178 -- 滚动条
179 enable_scroll_bar = false,
180
181 -- 平滑滚动
182 scrollback_lines = 5000,
183
184 -- macOS 动画感
185 animation_fps = 60,
186 max_fps = 60,
187}
188