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
| local wezterm = require 'wezterm' local config = wezterm.config_builder()
local is_windows = wezterm.target_triple:find("windows") ~= nil
if is_windows then config.default_prog = { "nu", "-l" } else config.default_prog = { "nu", "-l" } end
local launch_menu = {}
if is_windows then table.insert(launch_menu, { label = "Nushell", args = {"nu", "-l"} }) table.insert(launch_menu, { label = "Pwsh", args = {"pwsh.exe", "-NoLogo"} }) table.insert(launch_menu, { label = "CMD", args = {"cmd.exe"} }) table.insert(launch_menu, { label = "WSL: Fedora", args = {"wsl.exe", "-d", "fedora"} }) else table.insert(launch_menu, { label = "Nushell", args = {"nu", "-l"} }) table.insert(launch_menu, { label = "Zsh", args = {"zsh", "-l"} }) table.insert(launch_menu, { label = "Bash", args = {"bash", "-l"} }) table.insert(launch_menu, { label = "Fish", args = {"fish", "-l"} }) end
table.insert(launch_menu, { label = "SSH: Server", args = {"ssh", "user@ip"} })
config.launch_menu = launch_menu
wezterm.on('window-config-reloaded', function(window, pane) local overrides = window:get_config_overrides() or {} local appearance = window:get_appearance() local is_dark = appearance:find("Dark") if is_dark then overrides.colors = { background = '#000000' } overrides.color_scheme = 'Catppuccin Mocha' else overrides.colors = { background = '#f8f8f8' } overrides.color_scheme = 'Catppuccin Latte' end window:set_config_overrides(overrides) end)
config.window_background_opacity = 0.5
config.enable_tab_bar = false config.window_decorations = "RESIZE" config.window_padding = { left = 15, right = 15, top = 15, bottom = 10 } config.enable_scroll_bar = false
config.default_cursor_style = 'BlinkingBar'
config.max_fps = 165
config.scrollback_lines = 20000
config.font = wezterm.font_with_fallback({ { family = 'JetBrainsMono Nerd Font', weight = 'Medium', harfbuzz_features = { 'calt', 'liga', 'clig' } }, { family = 'FiraCode Nerd Font', weight = 'Medium' }, { family = 'Microsoft YaHei', weight = 'Regular' }, { family = 'Noto Sans SC', weight = 'Regular' }, }) config.font_size = 12.0
wezterm.on('toggle-all-controls', function(window, pane) local overrides = window:get_config_overrides() or {} if not overrides.enable_tab_bar then overrides.enable_tab_bar = true overrides.window_decorations = "INTEGRATED_BUTTONS|RESIZE" else overrides.enable_tab_bar = false overrides.window_decorations = "RESIZE" end window:set_config_overrides(overrides) end)
config.hyperlink_rules = wezterm.default_hyperlink_rules()
config.initial_cols = 80 config.initial_rows = 20
wezterm.on('gui-startup', function(cmd) local screen = wezterm.gui.screens().main local width = 1200 local height = 600 local _, _, window = wezterm.mux.spawn_window(cmd or {}) local gui_window = window:gui_window() local x = (screen.width - width) / 2 local y = (screen.height - height) / 2 gui_window:set_position(x, y) end)
config.disable_default_key_bindings = true config.keys = { { key = 'C', mods = 'CTRL', action = wezterm.action_callback(function(window, pane) local selection = window:get_selection_text_for_pane(pane) if selection == "" then window:perform_action(wezterm.action.SendKey{key='c', mods='CTRL'}, pane) else window:perform_action(wezterm.action.CopyTo 'Clipboard', pane) end end), }, { key = 'V', mods = 'CTRL|SHIFT', action = wezterm.action.PasteFrom 'Clipboard' }, { key = 'P', mods = 'CTRL|SHIFT', action = wezterm.action.ActivateCommandPalette }, { key = 'B', mods = 'CTRL|SHIFT', action = wezterm.action.EmitEvent 'toggle-all-controls' }, { key = 's', mods = 'ALT', action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' } }, { key = 'v', mods = 'ALT', action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' } }, { key = 'F', mods = 'CTRL|SHIFT', action = wezterm.action.Search { CaseInSensitiveString = "" } }, { key = 's', mods = 'ALT', action = wezterm.action.ShowLauncherArgs { flags = 'LAUNCH_MENU_ITEMS' } }, }
config.automatically_reload_config = true
return config
|