2026 AIGC 全球挑战赛收官:131 组作品角逐,为北京数字经济发展注入新动能!
2026/6/18 12:29:16
【免费下载链接】weztermA GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust项目地址: https://gitcode.com/GitHub_Trending/we/wezterm
还在为终端工具的功能限制而烦恼吗?WezTerm作为一款GPU加速的跨平台终端工具和多路复用器,提供了强大的自定义能力。本文将带你从零开始,打造一个既美观又高效的个性化终端环境。
首先在你的用户主目录创建.wezterm.lua配置文件:
-- 引入wezterm API local wezterm = require 'wezterm' -- 创建配置构建器 local config = wezterm.config_builder() -- 基础窗口设置 config.initial_cols = 120 -- 初始列数 config.initial_rows = 28 -- 初始行数 config.font_size = 12 -- 字体大小 config.color_scheme = 'AdventureTime' -- 配色方案 -- 返回配置 return config-- 字体配置 config.font = wezterm.font_with_fallback({ "JetBrains Mono", "Fira Code", "Noto Color Emoji" }) config.font_size = 13.0 config.line_height = 1.2 -- 配色方案(内置多种主题) config.color_scheme = "Catppuccin Mocha" -- 推荐主题 -- 窗口外观 config.window_background_opacity = 0.95 -- 背景透明度 config.text_background_opacity = 0.9 -- 文本背景透明度 config.window_decorations = "RESIZE" -- 窗口装饰| 主题名称 | 风格 | 适用场景 |
|---|---|---|
AdventureTime | 明亮多彩 | 日常开发 |
Batman | 暗色系 | 夜间编程 |
Catppuccin | 柔和渐变 | 长时间使用 |
Dracula | 经典暗色 | 通用场景 |
GitHub Dark | GitHub风格 | 代码审查 |
WezTerm提供了丰富的键盘映射功能,支持自定义工作流:
-- 设置Leader键(类似Vim的Leader) config.leader = { key = 'a', mods = 'CTRL', timeout_milliseconds = 1000 } -- 自定义快捷键 config.keys = { -- 水平分割窗格 { key = '|', mods = 'LEADER|SHIFT', action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' }, }, -- 垂直分割窗格 { key = '-', mods = 'LEADER', action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' }, }, -- 切换窗格 { key = 'h', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection 'Left', }, { key = 'j', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection 'Down', }, { key = 'k', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection 'Up', }, { key = 'l', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection 'Right', }, }-- 启用多路复用 config.enable_wayland = true -- 自动保存会话 config.automatically_reload_config = true -- 标签页配置 config.tab_bar_at_bottom = true config.use_fancy_tab_bar = false config.show_tab_index_in_tab_bar = true -- 状态栏配置 config.status_update_interval = 1000wezterm.on('update-status', function(window, pane) local date = wezterm.strftime('%Y-%m-%d %H:%M:%S') window:set_right_status(wezterm.format({ { Foreground = { Color = '#ffffff' } }, { Background = { Color = '#333333' } }, { Text = ' ' .. date .. ' ' }, })) end)-- 启用GPU加速 config.front_end = "WebGpu" -- 或者 "OpenGL" -- 渲染优化 config.animation_fps = 60 config.max_fps = 60 config.scrollback_lines = 10000 -- 内存优化 config.audible_bell = "SystemBeep" config.visual_bell = { fade_in_function = "EaseIn", fade_in_duration_ms = 150, fade_out_function = "EaseOut", fade_out_duration_ms = 150, }-- 检测操作系统 if wezterm.target_triple:find("windows") then -- Windows特定配置 config.default_prog = { "pwsh", "-NoLogo" } config.launch_menu = { { label = "PowerShell", args = { "pwsh", "-NoLogo" }, }, { label = "Command Prompt", args = { "cmd.exe" }, }, } elseif wezterm.target_triple:find("apple") then -- macOS特定配置 config.window_background_opacity = 0.92 config.macos_window_background_blur = 20 else -- Linux特定配置 config.enable_wayland = true config.x11_embed_into_parent = false end-- 引入辅助模块 local helpers = require 'helpers' local colors = require 'colors' -- 应用模块配置 helpers.apply_to_config(config) colors.apply_color_scheme(config) -- 自定义函数 local function setup_workspaces(config) config.workspaces = { { name = "development", spawn = { "cd", "~/projects" } }, { name = "system", spawn = { "cd", "~" } } } end setup_workspaces(config)-- 调试模式 config.debug_key_events = false -- 日志配置 config.log_level = "INFO" -- 可选: ERROR, WARN, INFO, DEBUG -- 重载配置快捷键 config.keys = { { key = 'r', mods = 'CTRL|SHIFT', action = wezterm.action.ReloadConfiguration, }, -- 其他快捷键... }| 配置项 | 默认值 | 优化值 | 效果提升 |
|---|---|---|---|
| 字体渲染 | 系统默认 | 多字体回退 | 字符兼容性↑ |
| 配色方案 | 基础主题 | Catppuccin | 视觉舒适度↑ |
| 窗格管理 | 基础快捷键 | Leader键模式 | 操作效率↑ |
| GPU加速 | 软件渲染 | WebGpu | 渲染性能↑ |
| 会话管理 | 无持久化 | 自动保存 | 工作流连续性↑ |
通过本文的配置指南,你已经能够:
现在就开始你的WezTerm个性化之旅吧!通过不断调整和优化,你将获得一个真正适合自己的高效终端环境。
【免费下载链接】weztermA GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust项目地址: https://gitcode.com/GitHub_Trending/we/wezterm
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考