Dernière activité 1 month ago

WezTerm 主题(兼容 Linux 和 Window)

Révision c8af26bccdfe1cba1ec8d72e88f2f2649b952862

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