Ostatnio aktywny 1 month ago

WezTerm 主题(兼容 Linux 和 Window)

Rewizja 00e687cab584bd916f5f4a8be9185953aa90bccd

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