Skip to content

Instantly share code, notes, and snippets.

@mate-h
Last active March 10, 2025 01:31
Show Gist options
  • Save mate-h/91ddaee2589061cd20a72755b89ae3ac to your computer and use it in GitHub Desktop.
Save mate-h/91ddaee2589061cd20a72755b89ae3ac to your computer and use it in GitHub Desktop.
WezTerm configuration
local wezterm = require 'wezterm'
local schemes = wezterm.get_builtin_color_schemes()
local scheme = schemes['OneDark (base16)']
local bg_color, fg_color, active_color, hover_color, text_color
local dark_mode = wezterm.gui.get_appearance() == "Dark"
if dark_mode then
bg_color = '#0d1117' -- editor.background from dark theme
fg_color = '#161b22' -- editorWidget.background from dark theme
active_color = '#7d8590' -- titleBar.activeForeground from dark theme
hover_color = '#21262d' -- list.hoverBackground from dark theme
text_color = '#e6edf3' -- foreground from dark theme
scheme = {
background = '#0d1117',
foreground = '#e6edf3',
cursor_bg = '#2f81f7',
cursor_fg = '#0d1117',
selection_bg = 'rgba(56, 139, 253, 0.15)',
selection_fg = '#e6edf3',
ansi = {
'#484f58', -- black
'#ff7b72', -- red
'#3fb950', -- green
'#d29922', -- yellow
'#58a6ff', -- blue
'#bc8cff', -- magenta
'#39c5cf', -- cyan
'#b1bac4', -- white
},
brights = {
'#6e7681', -- bright black
'#ffa198', -- bright red
'#56d364', -- bright green
'#e3b341', -- bright yellow
'#79c0ff', -- bright blue
'#d2a8ff', -- bright magenta
'#56d4dd', -- bright cyan
'#ffffff', -- bright white
}
}
else
bg_color = '#ffffff' -- editor.background from light theme
fg_color = '#f6f8fa' -- editorWidget.background from light theme
active_color = '#2f363d' -- titleBar.activeForeground from light theme
hover_color = '#ebf0f4' -- list.hoverBackground from light theme
text_color = '#24292e' -- editor.foreground from light theme
scheme = {
background = '#ffffff',
foreground = '#24292e',
cursor_bg = '#005cc5',
cursor_fg = '#ffffff',
selection_bg = 'rgba(204, 229, 255, 0.8)',
selection_fg = '#24292e',
ansi = {
'#24292e', -- black
'#d73a49', -- red
'#28a745', -- green
'#dbab09', -- yellow
'#0366d6', -- blue
'#5a32a3', -- magenta
'#1b7c83', -- cyan
'#6a737d', -- white
},
brights = {
'#959da5', -- bright black
'#cb2431', -- bright red
'#22863a', -- bright green
'#b08800', -- bright yellow
'#005cc5', -- bright blue
'#5a32a3', -- bright magenta
'#3192aa', -- bright cyan
'#d1d5da', -- bright white
}
}
end
local cell_width = 0.8
wezterm.on('update-status', function(window)
local overrides = window:get_config_overrides() or {}
local screens = wezterm.gui.screens()
-- retina displays need a wider cell width
if screens["active"]["effective_dpi"] >= 144 then
cell_width = 0.9
else
cell_width = 0.8
end
if overrides.cell_width == cell_width then
return
end
wezterm.log_info("Setting cell width to " .. cell_width .. " for DPI " .. screens["active"]["effective_dpi"])
overrides.cell_width = cell_width
window:set_config_overrides(overrides)
end)
local fonts = { wezterm.font("SF Mono", {
weight = "Light",
stretch = "Normal",
style = "Normal"
}), wezterm.font("SF Mono", {
weight = "Light",
stretch = "Normal",
style = "Italic"
}), wezterm.font("SF Mono", {
weight = "Regular",
stretch = "Normal",
style = "Normal"
}), wezterm.font("SF Mono", {
weight = "Regular",
stretch = "Normal",
style = "Italic"
}), wezterm.font("SF Mono", {
weight = "Medium",
stretch = "Normal",
style = "Normal"
}), wezterm.font("SF Mono", {
weight = "Medium",
stretch = "Normal",
style = "Italic"
}), wezterm.font("SF Mono", {
weight = "DemiBold",
stretch = "Normal",
style = "Normal"
}), wezterm.font("SF Mono", {
weight = "DemiBold",
stretch = "Normal",
style = "Italic"
}), wezterm.font("SF Mono", {
weight = "Bold",
stretch = "Normal",
style = "Normal"
}), wezterm.font("SF Mono", {
weight = "Bold",
stretch = "Normal",
style = "Italic"
}), wezterm.font("SF Mono", {
weight = "Black",
stretch = "Normal",
style = "Normal"
}), wezterm.font("SF Mono", {
weight = "Black",
stretch = "Normal",
style = "Italic"
}) }
local selected_font = fonts[5]
return {
ssh_domains = {
{
name = 'clouddesk',
remote_address = 'mateho.aka.corp.amazon.com',
username = 'mateho',
ssh_option = {
identityfile = '/Users/mateho/.ssh/id_ecdsa',
},
},
},
color_schemes = {
['GitHub Custom'] = scheme
},
color_scheme = "GitHub Custom",
window_padding = {
left = 16,
right = 16,
top = 16,
bottom = 0
},
window_frame = {
font = selected_font,
active_titlebar_bg = bg_color,
inactive_titlebar_bg = bg_color
},
command_palette_bg_color = bg_color,
colors = {
background = fg_color,
tab_bar = {
background = bg_color,
active_tab = {
bg_color = fg_color,
fg_color = text_color
},
inactive_tab = {
bg_color = bg_color,
fg_color = active_color
},
inactive_tab_hover = {
bg_color = hover_color,
fg_color = active_color
},
new_tab = {
bg_color = bg_color,
fg_color = active_color
},
new_tab_hover = {
bg_color = hover_color,
fg_color = active_color
}
}
},
hide_tab_bar_if_only_one_tab = true,
window_close_confirmation = "NeverPrompt",
font_size = 13,
cell_width = cell_width,
underline_position = -2,
font = selected_font,
keys = { {
key = 'k',
mods = 'CMD',
action = wezterm.action.ClearScrollback 'ScrollbackAndViewport'
}, {
key = "d",
mods = "CMD",
action = wezterm.action {
SplitHorizontal = {
domain = "CurrentPaneDomain"
}
}
}, {
key = "d",
mods = "CMD|SHIFT",
action = wezterm.action {
SplitVertical = {
domain = "CurrentPaneDomain"
}
}
}, {
key = "w",
mods = "CMD",
action = wezterm.action {
CloseCurrentPane = {
confirm = false
}
}
}, {
key = "L",
mods = "CMD",
action = wezterm.action.ShowDebugOverlay
},
{
key = "P",
mods = "CMD",
action = wezterm.action.ActivateCommandPalette,
},
}
}
@mate-h
Copy link
Author

mate-h commented Nov 23, 2023

Install with:

mkdir -p ~/.config/wezterm && curl -o ~/.config/wezterm/wezterm.lua https://gist.githubusercontent.com/mate-h/91ddaee2589061cd20a72755b89ae3ac/raw/71242ed6933b8956ad8571be2787facb706eaba2/wezterm.lua

Install font from:
https://github.com/kube/sf-mono-ligaturized

@mate-h
Copy link
Author

mate-h commented Mar 10, 2025

Screenshot 2025-03-09 at 6 30 07 PM Screenshot 2025-03-09 at 6 30 24 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment