Skip to content

Instantly share code, notes, and snippets.

@HammzaHM
Last active November 23, 2025 09:34
Show Gist options
  • Select an option

  • Save HammzaHM/8f9b1e3812be77a27a40a25dc66f9a5f to your computer and use it in GitHub Desktop.

Select an option

Save HammzaHM/8f9b1e3812be77a27a40a25dc66f9a5f to your computer and use it in GitHub Desktop.
WezTerm Lua config file
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This will hold the configuration.
local config = wezterm.config_builder()
-- ============================================
-- WINDOW CONFIGURATION
-- ============================================
-- Full width and full height terminal
config.initial_cols = 180
config.initial_rows = 100
config.window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
}
-- Window decorations
config.window_decorations = "INTEGRATED_BUTTONS|RESIZE"
config.hide_tab_bar_if_only_one_tab = false
-- Maximize window on startup and when config reloads
local function maximize_window(window)
local active_screen = wezterm.gui.screens().active
if window and window:gui_window() then
window:gui_window():set_position(active_screen.x, active_screen.y)
window:gui_window():set_inner_size(active_screen.width, active_screen.height)
end
end
-- Maximize window when config reloads
wezterm.on('window-config-reloaded', function(window, pane)
maximize_window(window)
end)
-- Maximize window on startup
wezterm.on('gui-startup', function(cmd)
local active_screen = wezterm.gui.screens().active
local tab, pane, window = wezterm.mux.spawn_window(cmd or {})
if window and window:gui_window() then
window:gui_window():set_position(active_screen.x, active_screen.y)
window:gui_window():set_inner_size(active_screen.width, active_screen.height)
end
end)
-- ============================================
-- APPEARANCE
-- ============================================
config.color_scheme = 'Catppuccin-Mocha'
config.font_size = 20 -- Increased zoom (about 3x from default) for better visibility
config.default_cursor_style = 'BlinkingBar'
-- Make foreground text brighter
config.foreground_text_hsb = {
hue = 1.0,
saturation = 1.2,
brightness = 1.5,
}
-- ============================================
-- KEY BINDINGS
-- ============================================
config.keys = {
-- Split horizontally: CMD + d
{
key = 'd',
mods = 'CMD',
action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' },
},
-- Split vertically: CMD + SHIFT + V
{
key = 'v',
mods = 'CMD|SHIFT',
action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' },
},
-- Close pane: CMD + w (keeping your existing binding)
{
key = 'w',
mods = 'CMD',
action = wezterm.action.CloseCurrentPane { confirm = true },
},
-- Zoom in: CMD + = (can be used up to 3 times)
{
key = '=',
mods = 'CMD',
action = wezterm.action.IncreaseFontSize,
},
-- Zoom out: CMD + -
{
key = '-',
mods = 'CMD',
action = wezterm.action.DecreaseFontSize,
},
-- Reset zoom: CMD + 0
{
key = '0',
mods = 'CMD',
action = wezterm.action.ResetFontSize,
},
-- Navigate between panes
{
key = 'h',
mods = 'CMD|SHIFT',
action = wezterm.action.ActivatePaneDirection 'Left',
},
{
key = 'l',
mods = 'CMD|SHIFT',
action = wezterm.action.ActivatePaneDirection 'Right',
},
{
key = 'k',
mods = 'CMD|SHIFT',
action = wezterm.action.ActivatePaneDirection 'Up',
},
{
key = 'j',
mods = 'CMD|SHIFT',
action = wezterm.action.ActivatePaneDirection 'Down',
},
-- Resize panes
{
key = 'LeftArrow',
mods = 'CMD|SHIFT',
action = wezterm.action.AdjustPaneSize { 'Left', 5 },
},
{
key = 'RightArrow',
mods = 'CMD|SHIFT',
action = wezterm.action.AdjustPaneSize { 'Right', 5 },
},
{
key = 'UpArrow',
mods = 'CMD|SHIFT',
action = wezterm.action.AdjustPaneSize { 'Up', 5 },
},
{
key = 'DownArrow',
mods = 'CMD|SHIFT',
action = wezterm.action.AdjustPaneSize { 'Down', 5 },
},
-- Move through words: CMD + Option + Left/Right Arrow
-- Sends ALT+b (backward word) and ALT+f (forward word) to terminal
{
key = 'LeftArrow',
mods = 'CMD|OPT',
action = wezterm.action.SendKey { key = 'b', mods = 'ALT' },
},
{
key = 'RightArrow',
mods = 'CMD|OPT',
action = wezterm.action.SendKey { key = 'f', mods = 'ALT' },
},
-- Move through words: Option + Left/Right Arrow
-- Option+LeftArrow moves backward by word, Option+RightArrow moves forward by word
{
key = 'LeftArrow',
mods = 'OPT',
action = wezterm.action.SendKey { key = 'b', mods = 'ALT' },
},
{
key = 'RightArrow',
mods = 'OPT',
action = wezterm.action.SendKey { key = 'f', mods = 'ALT' },
},
-- Move to beginning of line: CMD + Left Arrow
-- Sends CTRL+a to terminal
{
key = 'LeftArrow',
mods = 'CMD',
action = wezterm.action.SendKey { key = 'a', mods = 'CTRL' },
},
-- Move to end of line: CMD + Right Arrow
-- Sends CTRL+e to terminal
{
key = 'RightArrow',
mods = 'CMD',
action = wezterm.action.SendKey { key = 'e', mods = 'CTRL' },
},
-- Delete entire line: CMD + Backspace
-- Sends CTRL+u to terminal (deletes from cursor to beginning of line)
{
key = 'Backspace',
mods = 'CMD',
action = wezterm.action.SendKey { key = 'u', mods = 'CTRL' },
},
-- Delete entire line: CMD + Delete (forward delete key)
-- Sends CTRL+u to terminal
{
key = 'Delete',
mods = 'CMD',
action = wezterm.action.SendKey { key = 'u', mods = 'CTRL' },
},
}
-- ============================================
-- LAUNCH MENU (for future use)
-- ============================================
local launch_menu = {}
config.launch_menu = launch_menu
-- ============================================
-- ADDITIONAL ENHANCEMENTS
-- ============================================
-- Enable scrollback
config.scrollback_lines = 10000
-- ============================================
-- TAB BAR CONFIGURATION
-- ============================================
-- Enable tab bar
config.enable_tab_bar = true
config.tab_bar_at_bottom = false
-- Make tabs bigger and better looking
config.use_fancy_tab_bar = true
config.show_tab_index_in_tab_bar = true
config.show_new_tab_button_in_tab_bar = true
-- Tab styling - bigger and better looking
config.tab_max_width = 350 -- Maximum width for tabs (increased for bigger tabs)
-- Tab bar colors (Catppuccin Mocha theme)
config.colors = {
tab_bar = {
-- The background of the tab bar
background = '#11111b',
-- The active tab is the one that has focus in the window
active_tab = {
bg_color = '#1e1e2e',
fg_color = '#cdd6f4',
intensity = 'Bold',
underline = 'None',
italic = false,
strikethrough = false,
},
-- Inactive tabs are the tabs that do not have focus
inactive_tab = {
bg_color = '#181825',
fg_color = '#6c7086',
intensity = 'Normal',
underline = 'None',
italic = false,
strikethrough = false,
},
-- You can configure the `new_tab` and `new_tab_hover` styles if you'd like
new_tab = {
bg_color = '#11111b',
fg_color = '#6c7086',
intensity = 'Normal',
underline = 'None',
italic = false,
strikethrough = false,
},
new_tab_hover = {
bg_color = '#1e1e2e',
fg_color = '#89b4fa',
intensity = 'Bold',
underline = 'None',
italic = false,
strikethrough = false,
},
},
}
-- Custom function to format tab titles with better names
wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width)
local pane = tab.active_pane
local title = tab.tab_index + 1 .. ': '
-- Get the current working directory or process name
local process_name = pane.foreground_process_name
local cwd = pane.current_working_dir
-- Extract directory name from path
if cwd then
local cwd_str = tostring(cwd):gsub('file://', '')
local dir_name = cwd_str:match('([^/]+)/?$')
if dir_name then
title = title .. dir_name
else
title = title .. 'Terminal'
end
elseif process_name then
-- Use process name if available
local proc = process_name:match('([^/]+)$')
title = title .. (proc or 'Terminal')
else
title = title .. 'Terminal'
end
-- Add pane count if multiple panes
if #tab.panes > 1 then
title = title .. ' [' .. #tab.panes .. ']'
end
-- Style active tab differently
local is_active = tab.is_active
local background = is_active and '#1e1e2e' or '#181825'
local foreground = is_active and '#cdd6f4' or '#6c7086'
return {
{ Text = ' ' .. title .. ' ' }, -- Extra padding for bigger tabs
{ Background = { Color = background } },
{ Foreground = { Color = foreground } },
}
end)
-- Window background opacity (optional, can be adjusted)
config.window_background_opacity = 1.0
-- Enable ligatures for better font rendering
config.harfbuzz_features = { 'calt=1', 'clig=1', 'liga=1' }
-- Better performance
config.enable_wayland = false
return config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment