Skip to content

Instantly share code, notes, and snippets.

@frabjous
Created June 12, 2022 04:42
Show Gist options
  • Save frabjous/28263aadd401ebca85e693b766537379 to your computer and use it in GitHub Desktop.
Save frabjous/28263aadd401ebca85e693b766537379 to your computer and use it in GitHub Desktop.
Wezterm config
# Themer
[colors]
foreground = "#c1c6ca"
background = "#131518"
#cursor_bg = "#bbbbbb"
cursor_bg = "#8f5ac9"
#cursor_fg = "#8f5ac9"
cursor_fg = "#ffff00"
#cursor_fg = "#8f5ac9"
##cursor_bg = "#131518"
#cursor_border = "#bbbbbb"
cursor_border = "#8f5ac9"
selection_bg = "#87afdf"
selection_fg = "#131518"
ansi = ["#131518","#df8787","#afdf87","#ffffaf","#87afdf","#dfafdf","#afdfdf","#c1c6ca"]
#brights = ["#131518","#df8787","#afdf87","#ffffaf","#87afdf","#dfafdf","#afdfdf","#c1c6ca"]
brights = ["#303236","#df999a","#b8e09a","#f8f9ba","#98b9e1","#dfb9e1","#b8e0e1","#dee3e8"]
local wezterm = require 'wezterm'
local json = require 'dkjson'
local hostname=wezterm.hostname()
wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_width)
local numpanes = ''
if (#tab.panes > 1) then numpanes = '(' .. tostring(#tab.panes) .. ') ' end
return numpanes .. tab.active_pane.title
end)
-- format window title
wezterm.on("format-window-title", function(tab, pane, tabs, panes, config)
local numtabs = ''
if (#tabs > 1) then numtabs = '(' .. tostring(#tabs) .. ') ' end
return numtabs .. tab.active_pane.title
end)
return {
adjust_window_size_when_changing_font_size = false,
allow_square_glyphs_to_overflow_width = "WhenFollowedBySpace",
audible_bell = "Disabled",
automatically_reload_config = true,
bold_brightens_ansi_colors = false,
canonicalize_pasted_newlines = "LineFeed",
check_for_updates = false,
color_scheme = "Themer",
default_cursor_style = "BlinkingBar",
disable_default_key_bindings = true, -- use only my keybinds
enable_csi_u_key_encoding = true, -- allow ctrl-tab, others?
exit_behavior = "Close", -- close even when errors; may regret this
font = wezterm.font({
family = "Fira Code",
harfbuzz_features = {
"cv02", -- alternative g
"cv24", -- not equals with slash /=
"cv25", -- .- ligature
"cv26", -- :- ligature
"cv27", -- [] ligature
"cv30", -- longer bar
"ss01", -- alternative r
"ss03", -- alternative & ampersand
"ss05", -- different @ sign
"ss07", -- =~ !~ ligatures
"ss09" -- >>= <<= ||= |= ligatures
}
}),
font_rules = {
-- use Fira Mono for italics and bold italics
{
italic = true,
font = wezterm.font("Fira Mono", { italic = true })
},
{
italic = true,
intensity = "Bold",
font = wezterm.font("Fira Mono", {
italic = true,
weight = "Bold"
})
}
},
font_size = 14,
hide_tab_bar_if_only_one_tab = true,
-- desaturate inactive panes
inactive_pane_hsb = {
saturation = 0.8,
brightness = 0.4,
},
keys = {
-- LEADER MODIFIER (CapsLock) --
-- leader c for copy
{ key = "c", mods = "LEADER", action = wezterm.action({
CopyTo = "ClipboardAndPrimarySelection"
})},
-- leader f for search
{ key = "f", mods = "LEADER", action = wezterm.action({
Search={CaseInSensitiveString=""}
})},
-- leader shift F for regex search
{ key = "F", mods = "LEADER|SHIFT", action = wezterm.action({
Search={ Regex="" }
})},
-- leader h for "vertical" (horiz) split
{ key = "h", mods = "LEADER", action = wezterm.action({
SplitVertical = { domain = "CurrentPaneDomain" }
})},
-- leader k clears scrollback, shift k the viewport too
{ key = "k", mods = "LEADER", action = wezterm.action({
ClearScrollback="ScrollbackOnly"
})},
{ key = "K", mods = "LEADER|SHIFT", action = wezterm.action({
ClearScrollback="ScrollbackAndViewport"
})},
-- leader q is quick select
{ key = "q", mods = "LEADER", action = "QuickSelect" },
-- leader t spawns tab in current pane domain
{ key = "t", mods = "LEADER", action = wezterm.action({
SpawnTab = "CurrentPaneDomain"
})},
-- leader shift T spawns tab in default domain
{ key = "T", mods = "LEADER|SHIFT", action=wezterm.action({
SpawnTab = "DefaultDomain"
})},
-- leader v pastes
{ key = "v", mods = "LEADER", action = wezterm.action({
PasteFrom = "Clipboard"
})},
-- leader w closes current tab with confirm
{ key = "w", mods = "LEADER", action = wezterm.action({
CloseCurrentPane = { confirm = true }
})},
-- leader x opens copy mode
{ key = "x", mods = "LEADER", action = "ActivateCopyMode" },
-- leader z for pane zoom
{ key = "z", mods = "LEADER", action = "TogglePaneZoomState" },
-- leader space to show launcher
{ key = "Space", mods = "LEADER", action = "ShowLauncher" },
-- leader 1-5 goes to specific tab
{ key = "1", mods = "LEADER", action = wezterm.action({
ActivateTab = 0
})},
{ key = "2", mods = "LEADER", action = wezterm.action({
ActivateTab = 1
})},
{ key = "3", mods = "LEADER", action = wezterm.action({
ActivateTab = 2
})},
{ key = "4", mods = "LEADER", action = wezterm.action({
ActivateTab = 3
})},
{ key = "5", mods = "LEADER", action = wezterm.action({
ActivateTab = 4
})},
-- leader 0 resets font size
{ key = "0", mods = "LEADER", action = "ResetFontSize" },
-- leader enter for new window
{ key = "Enter", mods = "LEADER", action = "SpawnWindow" },
-- leader F5 reloads configuration
{ key = "F5", mods = "LEADER", action = "ReloadConfiguration" },
-- leader F11 for full screen
{ key = "F11", mods = "LEADER", action = "ToggleFullScreen" },
-- leader / and leader | for "horiz" (vert) split
{ key = "\\", mods = "LEADER", action = wezterm.action({
SplitHorizontal = { domain = "CurrentPaneDomain" }
})},
{ key = "|", mods = "LEADER|SHIFT", action = wezterm.action({
SplitHorizontal = { domain = "CurrentPaneDomain" }
})},
-- leader -/_ decreases font size
{ key = "-", mods = "LEADER", action = "DecreaseFontSize" },
{ key = "_", mods = "LEADER|SHIFT", action = "DecreaseFontSize" },
-- leader =/+ increases font size
{ key = "=", mods = "LEADER", action = "IncreaseFontSize" },
{ key = "+", mods = "LEADER|SHIFT", action = "IncreaseFontSize" },
-- leader tab, leader ] goes to next tab
{ key = "Tab", mods = "LEADER", action = wezterm.action({
ActivateTabRelative = 1
})},
{ key = "]", mods = "LEADER", action = wezterm.action({
ActivateTabRelative = 1
})},
-- leader shift tab, leader [ goes to prev tab
{ key = "Tab", mods = "LEADER|SHIFT", action = wezterm.action({
ActivateTabRelative = -1
})},
{ key = "[", mods = "LEADER", action = wezterm.action({
ActivateTabRelative = -1
})},
-- leader ctrl tab, leader ctrl ] moves tab (DOESN'T WORK)
{ key = "Tab", mods = "LEADER|CTRL", action = wezterm.action({
MoveTabRelative = 1
})},
{ key = "]", mods = "LEADER|CTRL", action = wezterm.action({
MoveTabRelative = 1
})},
-- leader page Up, leader Page Down scrolls
{ key = "PageUp", mods="LEADER", action=wezterm.action({
ScrollByPage = -1
})},
{ key = "PageDown", mods="LEADER", action=wezterm.action({
ScrollByPage=1
})},
-- leader arrow focus panes in direction
{ key = "LeftArrow", mods = "LEADER", action = wezterm.action({
ActivatePaneDirection = "Left"
})},
{ key = "RightArrow", mods = "LEADER", action = wezterm.action({
ActivatePaneDirection = "Right"
})},
{ key = "UpArrow", mods = "LEADER", action = wezterm.action({
ActivatePaneDirection = "Up"
})},
{ key = "DownArrow", mods = "LEADER", action = wezterm.action({
ActivatePaneDirection = "Down"
})},
-- leader shift arrow resizes pane
{ key = "LeftArrow", mods = "LEADER|SHIFT", action=wezterm.action({
AdjustPaneSize = { "Left", 1 }
})},
{ key = "RightArrow", mods = "LEADER|SHIFT", action=wezterm.action({
AdjustPaneSize = { "Right", 1 }
})},
{ key = "UpArrow", mods = "LEADER|SHIFT", action=wezterm.action({
AdjustPaneSize = { "Up", 1 }
})},
{ key = "DownArrow", mods = "LEADER|SHIFT", action=wezterm.action({
AdjustPaneSize = { "Down", 1 }
})},
-- OTHER MODIFIERS --
-- shift-control-c copies
{ key = "c", mods = "SHIFT|CTRL", action = wezterm.action({
CopyTo = "ClipboardAndPrimarySelection"
})},
-- ctrl-c either copy or interrupts depending on selection
{
key = "c",
mods = "CTRL",
action = wezterm.action_callback(function(window, pane)
local has_selection = (
window:get_selection_text_for_pane(pane) ~= ""
)
if (has_selection) then
window:perform_action(
wezterm.action({
CopyTo="ClipboardAndPrimarySelection"
}),
pane
)
-- not implemented yet; don't want it probably
-- window:perform_action("ClearSelection", pane)
else
window:perform_action(
wezterm.action({
SendKey = { key = "c", mods = "CTRL"}
}),
pane
)
end
end)
},
-- ctrl-v and shift-ctrl-v pastes
{ key = "v", mods = "CTRL", action = wezterm.action({
PasteFrom = "Clipboard"
})},
{ key = "v", mods = "CTRL|SHIFT", action = wezterm.action({
PasteFrom = "Clipboard"
})},
-- ctrl 0 resets font size
{ key = "0", mods = "CTRL", action = "ResetFontSize" },
-- shift insert pastes
{ key = "Insert", mods = "SHIFT", action = wezterm.action({
PasteFrom = "Clipboard"
})},
-- control insert copies
{ key = "Insert", mods = "CTRL", action = wezterm.action({
CopyTo = "ClipboardAndPrimarySelection"
})},
-- control -/_ decreases font size
{ key = "-", mods = "CTRL", action = "DecreaseFontSize" },
{ key = "_", mods = "CTRL|SHIFT", action = "DecreaseFontSize" },
-- control =/+ increases font size
{ key = "=", mods = "CTRL", action = "IncreaseFontSize" },
{ key = "+", mods = "CTRL|SHIFT", action = "IncreaseFontSize" },
-- Shift-PageUp, Shift-PageDown scrolls
{ key = "PageUp", mods = "SHIFT", action = wezterm.action({
ScrollByPage = -1
})},
{ key = "PageDown", mods = "SHIFT", action = wezterm.action({
ScrollByPage = 1
})}
},
-- capslock is leader
leader = { key = "VoidSymbol", mods="", timeout_milliseconds = 1000 },
pane_focus_follows_mouse = true,
term = "wezterm", -- use wezterm for $TERM variable
visual_bell = { -- make visual bell flare cursor
fade_in_duration_ms = 100,
fade_out_duration_ms = 100,
target = "CursorColor"
},
window_background_opacity = 0.7,
window_decorations = "NONE",
window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0
}
}
@frabjous
Copy link
Author

Themer.toml goes in colors subfolder of $HOME/.config/wezterm.

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