Skip to content

Instantly share code, notes, and snippets.

@mate-h
Last active April 16, 2024 19:30
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 = '#1f2227'
fg_color = '#24272d'
active_color = '#7D7f81'
hover_color = '#323842'
text_color = 'white'
scheme = schemes['OneDark (base16)']
else
bg_color = 'white'
fg_color = '#f5f5f5'
active_color = '#bdbdbd'
hover_color = '#e0e0e0'
text_color = 'black'
scheme = schemes['Ef-Trio-Light']
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 {
color_schemes = {
['OneDark Custom'] = scheme
},
color_scheme = "OneDark 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 Apr 16, 2024

light
dark

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