1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
| -- WezTerm Configuration -- Optimized for SSH client on Windows 10, lightweight and comfortable
local wezterm = require 'wezterm' local config = wezterm.config_builder()
---------------------------------------------------------- -- 字型 (Fonts) ----------------------------------------------------------
config.font = wezterm.font_with_fallback({ { family = "Source Code Pro", weight = "Regular", }, { family = "Noto Sans CJK TC", weight = "Regular", } })
config.font_size = 13
-- 字型渲染優化 (Font rendering optimization) config.freetype_load_target = "Light" config.freetype_render_target = "HorizontalLcd"
---------------------------------------------------------- -- 外觀 (Appearance) ----------------------------------------------------------
config.color_scheme = "Solarized Dark"
-- 完全不透明,SSH 看 log 最舒服 config.window_background_opacity = 1.0
-- 視窗邊框留白 (Window padding) config.window_padding = { left = 12, right = 12, top = 12, bottom = 12, }
---------------------------------------------------------- -- 視窗大小 (Window size) ----------------------------------------------------------
config.initial_cols = 160 config.initial_rows = 45
-- 避免調整字體時視窗跟著變大變小 config.adjust_window_size_when_changing_font_size = false
---------------------------------------------------------- -- 游標 (Cursor) ----------------------------------------------------------
-- 使用 I-Beam (直線) 游標,閃爍模式 config.default_cursor_style = "BlinkingBar" config.cursor_blink_rate = 500 config.cursor_blink_ease_in = "Constant" config.cursor_blink_ease_out = "Constant" config.cursor_thickness = 2
---------------------------------------------------------- -- Scrollback (歷史捲動緩衝區) ----------------------------------------------------------
-- 保留大量歷史輸出 config.scrollback_lines = 50000
---------------------------------------------------------- -- Tab Bar (分頁列) ----------------------------------------------------------
-- 使用 tmux 或只用單一 SSH 連線,不需要 WezTerm Tab config.enable_tab_bar = false
---------------------------------------------------------- -- 關閉確認視窗 (Close confirmation) ----------------------------------------------------------
config.window_close_confirmation = "NeverPrompt"
---------------------------------------------------------- -- 滑鼠 (Mouse) ----------------------------------------------------------
-- 打字時隱藏滑鼠游標 config.hide_mouse_cursor_when_typing = true
-- 滑鼠拖曳選字時的邊界字元 config.selection_word_boundary = " \t\n{}[]()\"'`,;:"
-- 貼上時將換行正規化為 LF (\n),避免 SSH 遠端出現多餘 carriage return config.canonicalize_pasted_newlines = "LineFeed"
-- 視覺閃爍提示 (搭配已關閉的嗶嗶聲,游標閃一下提示 bell 事件) config.visual_bell = { fade_in_duration_ms = 150, fade_out_duration_ms = 150, target = "CursorColor", }
---------------------------------------------------------- -- 啟動 Shell (Default program) ----------------------------------------------------------
-- 使用 PowerShell 作為預設 shell config.default_prog = { "powershell.exe" }
---------------------------------------------------------- -- 快捷鍵 (Key bindings) ----------------------------------------------------------
config.keys = { ------------------------------------------------------ -- 複製/貼上 (Ctrl+Shift+C/V) ------------------------------------------------------ { key = "C", mods = "CTRL|SHIFT", action = wezterm.action.CopyTo("Clipboard"), }, { key = "V", mods = "CTRL|SHIFT", action = wezterm.action.PasteFrom("Clipboard"), },
------------------------------------------------------ -- Shift+Insert 貼上 (Putty 習慣) ------------------------------------------------------ { key = "Insert", mods = "SHIFT", action = wezterm.action.PasteFrom("Clipboard"), }, { key = "Insert", mods = "CTRL", action = wezterm.action.CopyTo("Clipboard"), },
------------------------------------------------------ -- Ctrl + +/-/0 縮放字體 ------------------------------------------------------ { key = "+", mods = "CTRL", action = wezterm.action.IncreaseFontSize, }, { key = "-", mods = "CTRL", action = wezterm.action.DecreaseFontSize, }, { key = "0", mods = "CTRL", action = wezterm.action.ResetFontSize, },
------------------------------------------------------ -- Ctrl+Shift+N 開新視窗 ------------------------------------------------------ { key = "N", mods = "CTRL|SHIFT", action = wezterm.action.SpawnWindow, },
------------------------------------------------------ -- Shift+Home/End 捲動到最上/最下 ------------------------------------------------------ { key = "Home", mods = "SHIFT", action = wezterm.action.ScrollToTop, }, { key = "End", mods = "SHIFT", action = wezterm.action.ScrollToBottom, },
------------------------------------------------------ -- Ctrl+Shift+Enter 全螢幕切換 ------------------------------------------------------ { key = "Enter", mods = "CTRL|SHIFT", action = wezterm.action.ToggleFullScreen, },
------------------------------------------------------ -- Ctrl+Shift+P 指令面板 (Command palette) ------------------------------------------------------ { key = "P", mods = "CTRL|SHIFT", action = wezterm.action.ActivateCommandPalette, }, }
---------------------------------------------------------- -- 滑鼠綁定 (Mouse bindings) ----------------------------------------------------------
config.mouse_bindings = { -- 滑鼠左鍵放開時自動複製選取文字到剪貼簿 (選取即複製) -- 同時保留點擊 URL 超連結開啟的功能 { event = { Up = { streak = 1, button = "Left" } }, mods = "NONE", action = wezterm.action.CompleteSelectionOrOpenLinkAtMouseCursor("Clipboard"), }, -- 滑鼠右鍵點擊貼上 { event = { Down = { streak = 1, button = "Right" } }, mods = "NONE", action = wezterm.action.PasteFrom("Clipboard"), }, }
---------------------------------------------------------- -- 效能與資源優化 (Performance optimization) ----------------------------------------------------------
-- 動畫更新率 (降低以節省資源) config.animation_fps = 1
-- 關閉嗶嗶聲 (避免遠端 tab 補完或錯誤提示的系統嗶聲) config.audible_bell = "Disabled"
-- 使用傳統鍵盤編碼,避免某些遠端程式的按鍵衝突 config.enable_csi_u_key_encoding = false
-- 自動重新載入設定檔 (方便除錯) config.automatically_reload_config = true
---------------------------------------------------------- -- 其他實用設定 (Other useful settings) ----------------------------------------------------------
-- 中文輸入法候選字視窗獨立顯示(不在視窗右邊) config.ime_preedit_rendering = "System"
-- 啟用超連結檢測 (方便點擊 URL) config.hyperlink_rules = wezterm.default_hyperlink_rules()
-- 啟用滾動條 (可選) -- config.enable_scroll_bar = true
-- 退出行為 config.exit_behavior = "CloseOnCleanExit" config.exit_behavior_messaging = "Verbose"
return config
|