wezterm.lua
· 2.4 KiB · Lua
Eredeti
local wezterm = require 'wezterm'
local act = wezterm.action
local target = wezterm.target_triple
local drag_mod = "SUPER"
local default_prog = nil
-- Windows 特殊处理
if target:find("windows") then
drag_mod = "ALT"
-- 只在 Windows 使用 PowerShell 7
default_prog = {
"C:\\Program Files\\PowerShell\\7\\pwsh.exe",
"-NoLogo",
"-ExecutionPolicy", "RemoteSigned"
}
end
return {
-- 设置底座
default_prog = default_prog,
set_environment_variables = {
TERM = "xterm-256color",
},
keys = {
-- 关闭当前 Tab
{
key = "w",
mods = "CTRL|SHIFT",
action = wezterm.action.CloseCurrentTab { confirm = true },
},
},
-- Ubuntu + GNOME 更像 iTerm2
window_frame = {
font_size = 11,
},
-- 像 macOS iTerm2 一样拖动窗口
mouse_bindings = {
{
event = { Down = { streak = 1, button = "Left" } },
mods = drag_mod,
action = act.StartWindowDrag,
},
},
-- GPU 渲染
front_end = "WebGpu",
-- 字体(非常接近 macOS 观感)
font = wezterm.font_with_fallback({
"JetBrains Mono",
"Fira Code",
"Noto Sans Mono",
"JetBrainsMono Nerd Font",
}),
font_size = 12.5,
line_height = 1.15,
-- macOS 风格窗口
window_decorations = "RESIZE",
window_background_opacity = 0.93,
text_background_opacity = 0.93,
-- 光标(Sublime 风格)
default_cursor_style = "BlinkingBar",
cursor_blink_rate = 600,
-- 关闭顶部 tab bar(更像 iTerm2)
enable_tab_bar = false,
-- padding 像 macOS 终端
window_padding = {
left = 12,
right = 12,
top = 10,
bottom = 10,
},
-- 颜色主题(iTerm2 + Sublime 混合)
colors = {
foreground = "#E8E8E8",
background = "#1E1F22",
cursor_bg = "#A6E22E",
cursor_fg = "#1E1F22",
cursor_border = "#A6E22E",
selection_fg = "#FFFFFF",
selection_bg = "#44475A",
ansi = {
"#2D2A2E",
"#F92672",
"#A6E22E",
"#E6DB74",
"#66D9EF",
"#AE81FF",
"#38CCD1",
"#F8F8F2",
},
brights = {
"#75715E",
"#FF6188",
"#B6E354",
"#FFD866",
"#78DCE8",
"#AB9DF2",
"#3BC9DB",
"#FFFFFF",
},
-- iTerm2 风格 split
split = "#44475A",
},
-- 滚动条
enable_scroll_bar = false,
-- 平滑滚动
scrollback_lines = 5000,
-- macOS 动画感
animation_fps = 60,
max_fps = 60,
}
| 1 | local wezterm = require 'wezterm' |
| 2 | local act = wezterm.action |
| 3 | local target = wezterm.target_triple |
| 4 | |
| 5 | local drag_mod = "SUPER" |
| 6 | local default_prog = nil |
| 7 | |
| 8 | -- Windows 特殊处理 |
| 9 | if 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 | } |
| 18 | end |
| 19 | |
| 20 | return { |
| 21 | |
| 22 | -- 设置底座 |
| 23 | default_prog = default_prog, |
| 24 | |
| 25 | set_environment_variables = { |
| 26 | TERM = "xterm-256color", |
| 27 | }, |
| 28 | |
| 29 | keys = { |
| 30 | -- 关闭当前 Tab |
| 31 | { |
| 32 | key = "w", |
| 33 | mods = "CTRL|SHIFT", |
| 34 | action = wezterm.action.CloseCurrentTab { confirm = true }, |
| 35 | }, |
| 36 | }, |
| 37 | |
| 38 | -- Ubuntu + GNOME 更像 iTerm2 |
| 39 | window_frame = { |
| 40 | font_size = 11, |
| 41 | }, |
| 42 | |
| 43 | -- 像 macOS iTerm2 一样拖动窗口 |
| 44 | mouse_bindings = { |
| 45 | { |
| 46 | event = { Down = { streak = 1, button = "Left" } }, |
| 47 | mods = drag_mod, |
| 48 | action = act.StartWindowDrag, |
| 49 | }, |
| 50 | }, |
| 51 | |
| 52 | -- GPU 渲染 |
| 53 | front_end = "WebGpu", |
| 54 | |
| 55 | -- 字体(非常接近 macOS 观感) |
| 56 | font = wezterm.font_with_fallback({ |
| 57 | "JetBrains Mono", |
| 58 | "Fira Code", |
| 59 | "Noto Sans Mono", |
| 60 | "JetBrainsMono Nerd Font", |
| 61 | }), |
| 62 | |
| 63 | font_size = 12.5, |
| 64 | line_height = 1.15, |
| 65 | |
| 66 | -- macOS 风格窗口 |
| 67 | window_decorations = "RESIZE", |
| 68 | window_background_opacity = 0.93, |
| 69 | text_background_opacity = 0.93, |
| 70 | |
| 71 | -- 光标(Sublime 风格) |
| 72 | default_cursor_style = "BlinkingBar", |
| 73 | cursor_blink_rate = 600, |
| 74 | |
| 75 | -- 关闭顶部 tab bar(更像 iTerm2) |
| 76 | enable_tab_bar = false, |
| 77 | |
| 78 | -- padding 像 macOS 终端 |
| 79 | window_padding = { |
| 80 | left = 12, |
| 81 | right = 12, |
| 82 | top = 10, |
| 83 | bottom = 10, |
| 84 | }, |
| 85 | |
| 86 | -- 颜色主题(iTerm2 + Sublime 混合) |
| 87 | colors = { |
| 88 | foreground = "#E8E8E8", |
| 89 | background = "#1E1F22", |
| 90 | |
| 91 | cursor_bg = "#A6E22E", |
| 92 | cursor_fg = "#1E1F22", |
| 93 | cursor_border = "#A6E22E", |
| 94 | |
| 95 | selection_fg = "#FFFFFF", |
| 96 | selection_bg = "#44475A", |
| 97 | |
| 98 | ansi = { |
| 99 | "#2D2A2E", |
| 100 | "#F92672", |
| 101 | "#A6E22E", |
| 102 | "#E6DB74", |
| 103 | "#66D9EF", |
| 104 | "#AE81FF", |
| 105 | "#38CCD1", |
| 106 | "#F8F8F2", |
| 107 | }, |
| 108 | |
| 109 | brights = { |
| 110 | "#75715E", |
| 111 | "#FF6188", |
| 112 | "#B6E354", |
| 113 | "#FFD866", |
| 114 | "#78DCE8", |
| 115 | "#AB9DF2", |
| 116 | "#3BC9DB", |
| 117 | "#FFFFFF", |
| 118 | }, |
| 119 | |
| 120 | -- iTerm2 风格 split |
| 121 | split = "#44475A", |
| 122 | }, |
| 123 | |
| 124 | -- 滚动条 |
| 125 | enable_scroll_bar = false, |
| 126 | |
| 127 | -- 平滑滚动 |
| 128 | scrollback_lines = 5000, |
| 129 | |
| 130 | -- macOS 动画感 |
| 131 | animation_fps = 60, |
| 132 | max_fps = 60, |
| 133 | } |
| 134 |