最後活躍 1 month ago

WezTerm 主题(兼容 Linux 和 Window)

修訂 117ed0f05072ce3261c425bff0f3f656c01e5364

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 -- 新建 Tab(iTerm2 风格)
31 {
32 key = "t",
33 mods = "CTRL|SHIFT",
34 action = wezterm.action.SpawnTab("CurrentPaneDomain"),
35 -- action = hud("New Tab", act.SpawnTab("CurrentPaneDomain")),
36 },
37
38 -- 关闭 Tab
39 {
40 key = "w",
41 mods = "CTRL|SHIFT",
42 action = wezterm.action.CloseCurrentTab({ confirm = true }),
43 },
44
45 -- 下一个 Tab
46 {
47 key = "]",
48 mods = "CTRL|SHIFT",
49 action = wezterm.action.ActivateTabRelative(1),
50 -- action = hud("Next Tab",
51 -- act.ActivateTabRelative(1)
52 -- ),
53 },
54
55 -- 上一个 Tab
56 {
57 key = "[",
58 mods = "CTRL|SHIFT",
59 action = wezterm.action.ActivateTabRelative(-1),
60 },
61
62 -- 垂直分屏(像 Sublime)
63 --[[
64 {
65 key = "d",
66 mods = "CTRL|SHIFT",
67 action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
68 -- action = hud("Split Horizontal",
69 -- act.SplitHorizontal({ domain = "CurrentPaneDomain" })
70 -- ),
71 },
72 ]]
73
74 -- 水平分屏
75 --[[
76 {
77 key = "D",
78 mods = "CTRL|SHIFT",
79 action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }),
80 },
81 ]]
82 },
83
84 -- Ubuntu + GNOME 更像 iTerm2
85 window_frame = {
86 font_size = 11,
87 },
88
89 -- 像 macOS iTerm2 一样拖动窗口
90 mouse_bindings = {
91 {
92 event = { Down = { streak = 1, button = "Left" } },
93 mods = drag_mod,
94 action = act.StartWindowDrag,
95 },
96 },
97
98 -- GPU 渲染
99 front_end = "WebGpu",
100
101 -- 字体(非常接近 macOS 观感)
102 font = wezterm.font_with_fallback({
103 "JetBrains Mono",
104 "Fira Code",
105 "Noto Sans Mono",
106 "JetBrainsMono Nerd Font",
107 }),
108
109 font_size = 12.5,
110 line_height = 1.15,
111
112 -- macOS 风格窗口
113 window_decorations = "RESIZE",
114 window_background_opacity = 0.93,
115 text_background_opacity = 0.93,
116
117 -- 光标(Sublime 风格)
118 default_cursor_style = "BlinkingBar",
119 cursor_blink_rate = 600,
120
121 -- 关闭顶部 tab bar(更像 iTerm2)
122 enable_tab_bar = false,
123
124 -- padding 像 macOS 终端
125 window_padding = {
126 left = 12,
127 right = 12,
128 top = 10,
129 bottom = 10,
130 },
131
132 -- 颜色主题(iTerm2 + Sublime 混合)
133 colors = {
134 foreground = "#E8E8E8",
135 background = "#1E1F22",
136
137 cursor_bg = "#A6E22E",
138 cursor_fg = "#1E1F22",
139 cursor_border = "#A6E22E",
140
141 selection_fg = "#FFFFFF",
142 selection_bg = "#44475A",
143
144 ansi = {
145 "#2D2A2E",
146 "#F92672",
147 "#A6E22E",
148 "#E6DB74",
149 "#66D9EF",
150 "#AE81FF",
151 "#38CCD1",
152 "#F8F8F2",
153 },
154
155 brights = {
156 "#75715E",
157 "#FF6188",
158 "#B6E354",
159 "#FFD866",
160 "#78DCE8",
161 "#AB9DF2",
162 "#3BC9DB",
163 "#FFFFFF",
164 },
165
166 -- iTerm2 风格 split
167 split = "#44475A",
168 },
169
170 -- 滚动条
171 enable_scroll_bar = false,
172
173 -- 平滑滚动
174 scrollback_lines = 5000,
175
176 -- macOS 动画感
177 animation_fps = 60,
178 max_fps = 60,
179}
180