Last active
May 19, 2025 06:04
-
-
Save samundra/2d62e98d38740a41873b68cde8f7ea52 to your computer and use it in GitHub Desktop.
.config/wezterm/wezterm.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Pull in the wezterm API | |
local wezterm = require 'wezterm' | |
-- This will hold the configuration. | |
local config = wezterm.config_builder() | |
-- This is where you actually apply your config choices. | |
-- For example, changing the initial geometry for new windows: | |
config.initial_cols = 100 | |
config.initial_rows = 35 | |
config.dpi = 109.0 | |
-- or, changing the font size and color scheme. | |
-- config.font = wezterm.font 'JetBrains Mono' | |
-- config.font = wezterm.font 'FiraCode Nerd Font Mono' | |
config.font = wezterm.font('FiraCode Nerd Font Mono', { weight = 'Regular', italic = false }) | |
config.font_size = 10 | |
config.window_close_confirmation = "AlwaysPrompt" | |
-- config.font_rules { | |
-- { | |
-- intensity = 'Bold', | |
-- italic = true, | |
-- font = wezterm.font { | |
-- family = 'FiraCode Nerd Font Mono', | |
-- weight = 'Bold', | |
-- style = 'Italic', | |
-- }, | |
-- }, | |
-- { | |
-- intensity = 'Half', | |
-- italic = true, | |
-- font = wezterm.font { | |
-- family = 'FiraCode Nerd Font Mono', | |
-- weight = 'Bold', | |
-- style = 'Italic', | |
-- }, | |
-- }, | |
-- { | |
-- intensity = 'Normal', | |
-- italic = true, | |
-- font = wezterm.font { | |
-- family = 'FiraCode Nerd Font Mono', | |
-- style = 'Italic', | |
-- }, | |
-- }, | |
-- } | |
config.freetype_load_flags = 'NO_HINTING' | |
config.freetype_interpreter_version = 35 | |
config.freetype_load_target = 'Light' | |
config.line_height = 1.3 | |
config.cell_width = 0.9 | |
-- Disable ligatures | |
config.harfbuzz_features = { 'calt=0', 'clig=0', 'liga=0' } | |
-- Theme | |
-- config.color_scheme = 'Catppuccin Macchiato' -- Good one | |
-- config.color_scheme = 'Galaxy' -- Good one | |
config.color_scheme = 'Snazzy (base16)' -- Good one | |
-- config.color_scheme = 'Sandcastle (base16)' -- Good one | |
-- config.color_scheme = 'seoulbones_dark' -- Good one | |
-- Tab settings | |
config.use_fancy_tab_bar = false -- disable native tab styling | |
config.show_tabs_in_tab_bar = true | |
config.show_new_tab_button_in_tab_bar = false | |
config.tab_bar_at_bottom = true | |
config.tab_max_width = 999 | |
-- Window settings | |
config.pane_focus_follows_mouse = true | |
config.window_background_opacity = 0.9 | |
config.macos_window_background_blur = 20 | |
config.window_frame = { | |
font = wezterm.font { family = 'Roboto', weight = 'Bold' }, | |
font_size = 17.0, | |
active_titlebar_bg = '#333333', | |
inactive_titlebar_bg = '#333333', | |
} | |
-- Hold Command Button to Drag the Wezterm window around | |
config.window_decorations = "RESIZE" | |
config.scrollback_lines = 99999 | |
config.colors = { | |
tab_bar = { | |
background = '#0b0022', | |
active_tab = { | |
bg_color = '#2b2042', | |
fg_color = '#c0c0c0', | |
intensity = 'Bold', | |
underline = 'None', | |
italic = false, | |
strikethrough = false, | |
}, | |
inactive_tab = { | |
bg_color = '#1b1032', | |
fg_color = '#808080', | |
}, | |
-- The color of the inactive tab bar edge/divider | |
inactive_tab_edge = '#575757', | |
} | |
} | |
local act = wezterm.action | |
-- Keyboard Shortcuts | |
config.keys = { | |
{ key = '0', mods = 'CTRL', action = wezterm.action.ResetFontSize }, | |
{ | |
key = '[', | |
mods = 'CMD', | |
action = act.ActivatePaneDirection 'Left', | |
}, | |
{ | |
key = ']', | |
mods = 'CMD', | |
action = act.ActivatePaneDirection 'Right', | |
}, | |
{ | |
key = 'UpArrow', | |
mods = 'CMD', | |
action = act.ActivatePaneDirection 'Up', | |
}, | |
{ | |
key = 'DownArrow', | |
mods = 'CMD', | |
action = act.ActivatePaneDirection 'Down', | |
}, | |
-- iTerm like Split panes | |
{ | |
key = 'd', | |
mods = 'CMD', | |
action = act.SplitHorizontal { domain = 'CurrentPaneDomain' }, | |
}, | |
{ | |
key = 'd', | |
mods = 'CMD|SHIFT', | |
action = act.SplitVertical { domain = 'CurrentPaneDomain' }, | |
}, | |
{ | |
key = '8', | |
mods = 'CTRL', | |
action = act.PaneSelect { | |
alphabet = '1234567', | |
}, | |
}, | |
{ key = 'k', mods = 'CMD', action = act.ClearScrollback 'ScrollbackAndViewport' }, | |
{ key = 'w', mods = 'CMD', action = act.CloseCurrentPane { confirm = false } }, | |
} | |
-- Open Hyperlinks with Ctrl + Mouse click | |
config.mouse_bindings = { | |
{ | |
event = { Up = { streak = 1, button = 'Left' } }, | |
mods = 'CTRL', | |
action = act.OpenLinkAtMouseCursor, | |
}, | |
-- Disable the 'Down' event of CTRL-Click to avoid weird program behaviors | |
{ | |
event = { Down = { streak = 1, button = 'Left' } }, | |
mods = 'CTRL', | |
action = act.Nop, | |
}, | |
} | |
wezterm.on("gui-startup", function(cmd) | |
local screen = wezterm.gui.screens().active | |
local ratio = 0.7 | |
local width, height = screen.width * ratio, screen.height * ratio | |
local tab, pane, window = wezterm.mux.spawn_window { | |
position = { | |
x = (screen.width - width) / 2, | |
y = (screen.height - height) / 2, | |
origin = 'ActiveScreen' } | |
} | |
-- window:gui_window():maximize() | |
window:gui_window():set_inner_size(width, height) | |
end) | |
-- This function returns the suggested title for a tab. | |
-- It prefers the title that was set via `tab:set_title()` | |
-- or `wezterm cli set-tab-title`, but falls back to the | |
-- title of the active pane in that tab. | |
function tab_title(tab_info) | |
local title = tab_info.tab_title | |
-- if the tab title is explicitly set, take that | |
if title and #title > 0 then | |
return title | |
end | |
-- Otherwise, use the title from the active pane | |
-- in that tab | |
return tab_info.active_pane.title | |
end | |
wezterm.on( | |
'format-tab-title', | |
function(tab, tabs, panes, config, hover, max_width) | |
local title = tab_title(tab) | |
if tab.is_active then | |
return wezterm.format({ | |
{ Background = { Color = '008900' } }, | |
{ Foreground = { Color = 'ffffff' } }, | |
{ Attribute = { Intensity = 'Bold' } }, | |
{ Text = ' ' .. title .. ' ' }, | |
}) | |
end | |
if tab.is_last_active then | |
-- Green color and append '*' to previously active tab. | |
return wezterm.format({ | |
{ Background = { Color = 'green' } }, | |
{ Text = ' ' .. title .. '*' }, | |
}) | |
end | |
return title | |
end | |
) | |
-- Dim the inactive tabs | |
config.inactive_pane_hsb = { | |
saturation = 0.4, | |
brightness = 0.7 | |
} | |
-- Finally, return the configuration to wezterm: | |
return config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment