Skip to content

Instantly share code, notes, and snippets.

@shanksxz
Created May 9, 2025 00:20
Show Gist options
  • Select an option

  • Save shanksxz/6793bf70f1a2f57b4179a31b8ec511f4 to your computer and use it in GitHub Desktop.

Select an option

Save shanksxz/6793bf70f1a2f57b4179a31b8ec511f4 to your computer and use it in GitHub Desktop.
local wezterm = require 'wezterm'
local config = {}
if wezterm.config_builder then
config = wezterm.config_builder()
end
config.color_scheme = 'Vesper'
config.font = wezterm.font("JetBrains Mono NL")
config.font_size = 12
config.window_decorations = "RESIZE"
config.leader = { key = 'b', mods = 'CTRL', timeout_milliseconds = 1000 }
config.keys = {
{ key = 'c', mods = 'LEADER', action = wezterm.action.SpawnTab
"CurrentPaneDomain" },
{ key = 'x', mods = 'LEADER', action = wezterm.action.CloseCurrentPane { confirm = true } },
{ key = '%', mods = 'LEADER|SHIFT', action = wezterm.action.SplitHorizontal { domain = "CurrentPaneDomain" } },
{ key = '"', mods = 'LEADER|SHIFT', action = wezterm.action.SplitVertical { domain = "CurrentPaneDomain" } },
{ key = 'h', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection "Left" },
{ key = 'l', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection "Right" },
{ key = 'k', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection "Up" },
{ key = 'j', mods = 'LEADER', action = wezterm.action.ActivatePaneDirection "Down" },
-- Tab navigation (prev/next) like tmux
{ key = 'p', mods = 'LEADER', action = wezterm.action.ActivateTabRelative(-1) },
{ key = 'n', mods = 'LEADER', action = wezterm.action.ActivateTabRelative(1) },
-- Tab renaming (tmux-like)
{ key = ',', mods = 'LEADER', action = wezterm.action.PromptInputLine {
description = 'Enter new name for tab',
action = wezterm.action_callback(function(window, pane, line)
if line then
window:active_tab():set_title(line)
end
end),
}},
{ key = 'r', mods = 'LEADER', action = wezterm.action.ReloadConfiguration },
}
for i = 0, 9 do
config.keys[#config.keys + 1] = {
key = tostring(i),
mods = 'LEADER',
action = wezterm.action.ActivateTab(i),
}
end
config.hide_tab_bar_if_only_one_tab = false
config.tab_bar_at_bottom = false
config.use_fancy_tab_bar = false
config.tab_and_split_indices_are_zero_based = true
config.default_prog = { "pwsh.exe" }
config.colors = {
tab_bar = {
background = "#101010",
active_tab = {
bg_color = "#232323",
fg_color = "#A0A0A0",
},
inactive_tab = {
bg_color = "#161616",
fg_color = "#FEFEFE",
},
inactive_tab_hover = {
bg_color = "#1f1f1f",
fg_color = "#FFFFFF",
},
new_tab = {
bg_color = "#161616",
fg_color = "#FEFEFE",
},
new_tab_hover = {
bg_color = "#1f1f1f",
fg_color = "#FFFFFF",
},
},
}
local PS_ICON = "󰨊"
wezterm.on('format-tab-title', function(tab, tabs, panes, config, hover, max_width)
local title = tab.tab_title
if not title or #title == 0 then
title = "pwsh"
end
local index = tab.tab_index
return {
{ Text = string.format(" %d:%s %s ", index, PS_ICON, title) },
}
end)
config.window_frame = {
font = wezterm.font { family = 'JetBrains Mono NL', weight = 'Bold' },
font_size = 11.0,
active_titlebar_bg = "#101010",
inactive_titlebar_bg = "#101010",
}
wezterm.on('update-right-status', function(window, pane)
local elements = {}
local zoom_flag = window:active_tab():active_pane():is_zoomed() and "󰊕 " or
""
if zoom_flag ~= "" then
table.insert(elements, {
Background = { Color = "#101010" },
Foreground = { Color = "#65737E" },
Text = zoom_flag,
})
end
-- Date
table.insert(elements, {
Background = { Color = "#101010" },
Foreground = { Color = "#65737E" },
Text = " " .. wezterm.strftime("%Y-%m-%d "),
})
-- Time
table.insert(elements, {
Background = { Color = "#101010" },
Foreground = { Color = "#99FFE4" },
Text = wezterm.strftime("%H:%M "),
})
window:set_right_status(wezterm.format(elements))
end)
-- Left status bar (session name, tab/pane info)
wezterm.on('update-left-status', function(window, pane)
local elements = {}
table.insert(elements, {
Background = { Color = "#101010" },
Foreground = { Color = "#FFCFA8" },
Text = "",
})
table.insert(elements, {
Background = { Color = "#101010" },
Foreground = { Color = "#FFFFFF" },
Text = "WezTerm ",
})
table.insert(elements, {
Background = { Color = "#101010" },
Foreground = { Color = "#65737E" },
Text = "",
})
local tab = window:active_tab()
local tab_id = tab:tab_id()
local pane_id = pane:pane_id()
table.insert(elements, {
Background = { Color = "#101010" },
Foreground = { Color = "#99FFE4" },
Text = string.format("%d:%d ", tab_id, pane_id),
})
table.insert(elements, {
Background = { Color = "#101010" },
Foreground = { Color = "#65737E" },
Text = "",
})
if window:leader_is_active() then
table.insert(elements, {
Background = { Color = "#101010" },
Foreground = { Color = "#FFCFA8" },
Text = "󰌌",
})
end
window:set_left_status(wezterm.format(elements))
end)
return config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment