Naposledy aktivní 1 month ago

WezTerm 主题(兼容 Linux 和 Window)

Revize a729d533e84591c3a3a4a93bdaf54e072b0bf28b

wezterm.lua Raw
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
63 -- Ubuntu + GNOME 更像 iTerm2
64 window_frame = {
65 font_size = 11,
66 },
67
68 -- 像 macOS iTerm2 一样拖动窗口
69 mouse_bindings = {
70 {
71 event = { Down = { streak = 1, button = "Left" } },
72 mods = drag_mod,
73 action = act.StartWindowDrag,
74 },
75 },
76
77 -- GPU 渲染
78 front_end = "WebGpu",
79
80 -- 字体(非常接近 macOS 观感)
81 font = wezterm.font_with_fallback({
82 "JetBrains Mono",
83 "Fira Code",
84 "Noto Sans Mono",
85 "JetBrainsMono Nerd Font",
86 }),
87
88 font_size = 12.5,
89 line_height = 1.15,
90
91 -- macOS 风格窗口
92 window_decorations = "RESIZE",
93 window_background_opacity = 0.93,
94 text_background_opacity = 0.93,
95
96 -- 光标(Sublime 风格)
97 default_cursor_style = "BlinkingBar",
98 cursor_blink_rate = 600,
99
100 -- 关闭顶部 tab bar(更像 iTerm2)
101 enable_tab_bar = false,
102
103 -- padding 像 macOS 终端
104 window_padding = {
105 left = 12,
106 right = 12,
107 top = 10,
108 bottom = 10,
109 },
110
111 -- 颜色主题(iTerm2 + Sublime 混合)
112 colors = {
113 foreground = "#E8E8E8",
114 background = "#1E1F22",
115
116 cursor_bg = "#A6E22E",
117 cursor_fg = "#1E1F22",
118 cursor_border = "#A6E22E",
119
120 selection_fg = "#FFFFFF",
121 selection_bg = "#44475A",
122
123 ansi = {
124 "#2D2A2E",
125 "#F92672",
126 "#A6E22E",
127 "#E6DB74",
128 "#66D9EF",
129 "#AE81FF",
130 "#38CCD1",
131 "#F8F8F2",
132 },
133
134 brights = {
135 "#75715E",
136 "#FF6188",
137 "#B6E354",
138 "#FFD866",
139 "#78DCE8",
140 "#AB9DF2",
141 "#3BC9DB",
142 "#FFFFFF",
143 },
144
145 -- iTerm2 风格 split
146 split = "#44475A",
147 },
148
149 -- 滚动条
150 enable_scroll_bar = false,
151
152 -- 平滑滚动
153 scrollback_lines = 5000,
154
155 -- macOS 动画感
156 animation_fps = 60,
157 max_fps = 60,
158}
159