wezterm.lua
· 5.4 KiB · Lua
原始檔案
local wezterm = require 'wezterm'
local act = wezterm.action
local config = {}
if wezterm.config_builder then config = wezterm.config_builder() end
config.quit_when_all_windows_are_closed = false
config.scrollback_lines = 50000
config.enable_scroll_bar = true
config.audible_bell = "Disabled"
-- Visuals
config.font = wezterm.font_with_fallback {
{
family = '0xProto',
weight = 'Regular', -- https://wezfurlong.org/wezterm/config/lua/wezterm/font.html
harfbuzz_features = { -- https://wezfurlong.org/wezterm/config/font-shaping.html
'calt=0',
'clig=0',
'liga=0'
}
},
{
family = "Apple Color Emoji",
weight = "Regular",
stretch = "Normal",
style = "Normal"
},
'Noto Color Emoji'
}
config.font_rules = {
{
intensity = 'Bold',
italic = false,
font = wezterm.font {
family = '0xProto',
weight = "Bold",
},
},
{
intensity = 'Normal',
italic = true,
font = wezterm.font {
family = '0xProto',
style = "Italic",
weight = "Regular",
},
},
{
intensity = 'Bold',
italic = true,
font = wezterm.font {
family = '0xProto',
style = "Italic",
weight = 'Bold',
},
}
}
config.font_size = 14
config.line_height = 1.0
config.window_frame = {
font = wezterm.font {family = 'Iosevka Aile', weight = 700},
font_size = 14.0,
active_titlebar_bg = '#eeeeee',
inactive_titlebar_bg = '#ffffff'
}
config.use_fancy_tab_bar = true
-- Colors
local atom_one_light = wezterm.color.get_builtin_schemes()['AtomOneLight']
local color_scheme = wezterm.color.get_builtin_schemes()['AtomOneLight']
color_scheme.copy_mode_active_highlight_bg = { Color = '#e80da2' }
color_scheme.copy_mode_active_highlight_fg = { Color = '#ffffff' }
color_scheme.copy_mode_inactive_highlight_bg = { Color = '#eac7df' }
color_scheme.copy_mode_inactive_highlight_fg = { Color = '#000000' }
color_scheme.selection_fg = '#ffffff'
color_scheme.selection_bg = '#e80da2'
color_scheme.cursor_fg = '#ffffff'
color_scheme.cursor_bg = '#e80da2'
config.color_schemes = {
['AtomOneLight'] = atom_one_light,
['mjaschen'] = color_scheme,
}
config.color_scheme = 'mjaschen'
config.colors = {
tab_bar = {
active_tab = {bg_color = '#ffffff', fg_color = '#e80da2'},
inactive_tab = {bg_color = '#cccccc', fg_color = '#444444'},
inactive_tab_hover = {bg_color = '#eeeeee', fg_color = '#222222'},
new_tab = {bg_color = '#cccccc', fg_color = '#111111'},
new_tab_hover = {bg_color = '#eeeeee', fg_color = '#111111'},
inactive_tab_edge = '#575757'
}
}
-- Keyboard
config.keys = {
{
-- Make Option-Left equivalent to Alt-b which many line editors
-- interpret as backward-word
key = 'LeftArrow',
mods = 'OPT',
action = act.SendString '\x1bb'
}, {
-- Make Option-Right equivalent to Alt-f; forward-word
key = 'RightArrow',
mods = 'OPT',
action = act.SendString '\x1bf'
}, {
-- Split panes (right/left) with ⌘D
key = 'd',
mods = 'SUPER',
action = act.SplitHorizontal {domain = 'CurrentPaneDomain'}
}, {
-- Split panes (top/bottom) with ⌘⇧D
key = 'd',
mods = 'SUPER|SHIFT',
action = act.SplitVertical {domain = 'CurrentPaneDomain'}
}, {
-- Change to next pane with ⌘]
key = ']',
mods = 'SUPER',
action = act.ActivatePaneDirection('Next')
}, {
-- Change to previous pane with ⌘[
key = '[',
mods = 'SUPER',
action = act.ActivatePaneDirection('Prev')
}, {
-- Move Tab to the right with ⌘⇧-RightArrow
key = 'RightArrow',
mods = 'SUPER|SHIFT',
action = act.MoveTabRelative(1)
}, {
-- Move Tab to the left with ⌘⇧-LeftArrow
key = 'LeftArrow',
mods = 'SUPER|SHIFT',
action = act.MoveTabRelative(-1)
}, {
-- Clears the scrollback and viewport, and then sends CTRL-L to ask the
-- shell to redraw its prompt
key = 'k',
mods = 'SUPER',
action = act.Multiple {
act.ClearScrollback 'ScrollbackAndViewport',
act.SendKey {key = 'L', mods = 'CTRL'}
}
}, {
-- CMD-t open new tab in home directory
-- (default behavior: open new tab in current directory)
key = 't',
mods = 'CMD',
action = wezterm.action.SpawnCommandInNewTab {cwd = wezterm.home_dir}
}, {
-- Shift-Ctrl-Alt-k moves pane divider up
key = 'k',
mods = 'SHIFT|CTRL|ALT',
action = act.AdjustPaneSize {"Up", 3}
}, {
-- Shift-Ctrl-Alt-j moves pane divider down
key = 'j',
mods = 'SHIFT|CTRL|ALT',
action = act.AdjustPaneSize {"Down", 3}
}, {
-- Shift-Ctrl-Alt-h moves pane divider left
key = 'h',
mods = 'SHIFT|CTRL|ALT',
action = act.AdjustPaneSize {"Left", 3}
}, {
-- Shift-Ctrl-Alt-l moves pane divider right
key = 'l',
mods = 'SHIFT|CTRL|ALT',
action = act.AdjustPaneSize {"Right", 3}
}, {
-- Shift-Ctrl-Alt-z toggles zoom for current pane
key = 'z',
mods = 'SHIFT|CTRL|ALT',
action = act.TogglePaneZoomState
}
}
return config
| 1 | local wezterm = require 'wezterm' |
| 2 | local act = wezterm.action |
| 3 | |
| 4 | local config = {} |
| 5 | |
| 6 | if wezterm.config_builder then config = wezterm.config_builder() end |
| 7 | |
| 8 | config.quit_when_all_windows_are_closed = false |
| 9 | config.scrollback_lines = 50000 |
| 10 | config.enable_scroll_bar = true |
| 11 | config.audible_bell = "Disabled" |
| 12 | |
| 13 | |
| 14 | |
| 15 | -- Visuals |
| 16 | |
| 17 | config.font = wezterm.font_with_fallback { |
| 18 | { |
| 19 | family = '0xProto', |
| 20 | weight = 'Regular', -- https://wezfurlong.org/wezterm/config/lua/wezterm/font.html |
| 21 | harfbuzz_features = { -- https://wezfurlong.org/wezterm/config/font-shaping.html |
| 22 | 'calt=0', |
| 23 | 'clig=0', |
| 24 | 'liga=0' |
| 25 | } |
| 26 | }, |
| 27 | { |
| 28 | family = "Apple Color Emoji", |
| 29 | weight = "Regular", |
| 30 | stretch = "Normal", |
| 31 | style = "Normal" |
| 32 | }, |
| 33 | 'Noto Color Emoji' |
| 34 | } |
| 35 | |
| 36 | config.font_rules = { |
| 37 | |
| 38 | { |
| 39 | intensity = 'Bold', |
| 40 | italic = false, |
| 41 | font = wezterm.font { |
| 42 | family = '0xProto', |
| 43 | weight = "Bold", |
| 44 | }, |
| 45 | }, |
| 46 | |
| 47 | { |
| 48 | intensity = 'Normal', |
| 49 | italic = true, |
| 50 | font = wezterm.font { |
| 51 | family = '0xProto', |
| 52 | style = "Italic", |
| 53 | weight = "Regular", |
| 54 | }, |
| 55 | }, |
| 56 | |
| 57 | { |
| 58 | intensity = 'Bold', |
| 59 | italic = true, |
| 60 | font = wezterm.font { |
| 61 | family = '0xProto', |
| 62 | style = "Italic", |
| 63 | weight = 'Bold', |
| 64 | }, |
| 65 | } |
| 66 | |
| 67 | } |
| 68 | |
| 69 | config.font_size = 14 |
| 70 | config.line_height = 1.0 |
| 71 | |
| 72 | config.window_frame = { |
| 73 | font = wezterm.font {family = 'Iosevka Aile', weight = 700}, |
| 74 | font_size = 14.0, |
| 75 | active_titlebar_bg = '#eeeeee', |
| 76 | inactive_titlebar_bg = '#ffffff' |
| 77 | } |
| 78 | |
| 79 | config.use_fancy_tab_bar = true |
| 80 | |
| 81 | |
| 82 | -- Colors |
| 83 | |
| 84 | local atom_one_light = wezterm.color.get_builtin_schemes()['AtomOneLight'] |
| 85 | local color_scheme = wezterm.color.get_builtin_schemes()['AtomOneLight'] |
| 86 | |
| 87 | color_scheme.copy_mode_active_highlight_bg = { Color = '#e80da2' } |
| 88 | color_scheme.copy_mode_active_highlight_fg = { Color = '#ffffff' } |
| 89 | color_scheme.copy_mode_inactive_highlight_bg = { Color = '#eac7df' } |
| 90 | color_scheme.copy_mode_inactive_highlight_fg = { Color = '#000000' } |
| 91 | color_scheme.selection_fg = '#ffffff' |
| 92 | color_scheme.selection_bg = '#e80da2' |
| 93 | color_scheme.cursor_fg = '#ffffff' |
| 94 | color_scheme.cursor_bg = '#e80da2' |
| 95 | |
| 96 | config.color_schemes = { |
| 97 | ['AtomOneLight'] = atom_one_light, |
| 98 | ['mjaschen'] = color_scheme, |
| 99 | } |
| 100 | config.color_scheme = 'mjaschen' |
| 101 | |
| 102 | config.colors = { |
| 103 | tab_bar = { |
| 104 | active_tab = {bg_color = '#ffffff', fg_color = '#e80da2'}, |
| 105 | inactive_tab = {bg_color = '#cccccc', fg_color = '#444444'}, |
| 106 | inactive_tab_hover = {bg_color = '#eeeeee', fg_color = '#222222'}, |
| 107 | new_tab = {bg_color = '#cccccc', fg_color = '#111111'}, |
| 108 | new_tab_hover = {bg_color = '#eeeeee', fg_color = '#111111'}, |
| 109 | inactive_tab_edge = '#575757' |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | |
| 114 | |
| 115 | -- Keyboard |
| 116 | |
| 117 | config.keys = { |
| 118 | |
| 119 | { |
| 120 | -- Make Option-Left equivalent to Alt-b which many line editors |
| 121 | -- interpret as backward-word |
| 122 | key = 'LeftArrow', |
| 123 | mods = 'OPT', |
| 124 | action = act.SendString '\x1bb' |
| 125 | }, { |
| 126 | -- Make Option-Right equivalent to Alt-f; forward-word |
| 127 | key = 'RightArrow', |
| 128 | mods = 'OPT', |
| 129 | action = act.SendString '\x1bf' |
| 130 | }, { |
| 131 | -- Split panes (right/left) with ⌘D |
| 132 | key = 'd', |
| 133 | mods = 'SUPER', |
| 134 | action = act.SplitHorizontal {domain = 'CurrentPaneDomain'} |
| 135 | }, { |
| 136 | -- Split panes (top/bottom) with ⌘⇧D |
| 137 | key = 'd', |
| 138 | mods = 'SUPER|SHIFT', |
| 139 | action = act.SplitVertical {domain = 'CurrentPaneDomain'} |
| 140 | }, { |
| 141 | -- Change to next pane with ⌘] |
| 142 | key = ']', |
| 143 | mods = 'SUPER', |
| 144 | action = act.ActivatePaneDirection('Next') |
| 145 | }, { |
| 146 | -- Change to previous pane with ⌘[ |
| 147 | key = '[', |
| 148 | mods = 'SUPER', |
| 149 | action = act.ActivatePaneDirection('Prev') |
| 150 | }, { |
| 151 | -- Move Tab to the right with ⌘⇧-RightArrow |
| 152 | key = 'RightArrow', |
| 153 | mods = 'SUPER|SHIFT', |
| 154 | action = act.MoveTabRelative(1) |
| 155 | }, { |
| 156 | -- Move Tab to the left with ⌘⇧-LeftArrow |
| 157 | key = 'LeftArrow', |
| 158 | mods = 'SUPER|SHIFT', |
| 159 | action = act.MoveTabRelative(-1) |
| 160 | }, { |
| 161 | -- Clears the scrollback and viewport, and then sends CTRL-L to ask the |
| 162 | -- shell to redraw its prompt |
| 163 | key = 'k', |
| 164 | mods = 'SUPER', |
| 165 | action = act.Multiple { |
| 166 | act.ClearScrollback 'ScrollbackAndViewport', |
| 167 | act.SendKey {key = 'L', mods = 'CTRL'} |
| 168 | } |
| 169 | }, { |
| 170 | -- CMD-t open new tab in home directory |
| 171 | -- (default behavior: open new tab in current directory) |
| 172 | key = 't', |
| 173 | mods = 'CMD', |
| 174 | action = wezterm.action.SpawnCommandInNewTab {cwd = wezterm.home_dir} |
| 175 | }, { |
| 176 | -- Shift-Ctrl-Alt-k moves pane divider up |
| 177 | key = 'k', |
| 178 | mods = 'SHIFT|CTRL|ALT', |
| 179 | action = act.AdjustPaneSize {"Up", 3} |
| 180 | }, { |
| 181 | -- Shift-Ctrl-Alt-j moves pane divider down |
| 182 | key = 'j', |
| 183 | mods = 'SHIFT|CTRL|ALT', |
| 184 | action = act.AdjustPaneSize {"Down", 3} |
| 185 | }, { |
| 186 | -- Shift-Ctrl-Alt-h moves pane divider left |
| 187 | key = 'h', |
| 188 | mods = 'SHIFT|CTRL|ALT', |
| 189 | action = act.AdjustPaneSize {"Left", 3} |
| 190 | }, { |
| 191 | -- Shift-Ctrl-Alt-l moves pane divider right |
| 192 | key = 'l', |
| 193 | mods = 'SHIFT|CTRL|ALT', |
| 194 | action = act.AdjustPaneSize {"Right", 3} |
| 195 | }, { |
| 196 | -- Shift-Ctrl-Alt-z toggles zoom for current pane |
| 197 | key = 'z', |
| 198 | mods = 'SHIFT|CTRL|ALT', |
| 199 | action = act.TogglePaneZoomState |
| 200 | } |
| 201 | |
| 202 | } |
| 203 | |
| 204 | return config |
| 205 |