Skip to content

Instantly share code, notes, and snippets.

@lotusirous
Last active August 26, 2024 01:51
Show Gist options
  • Save lotusirous/88dc1db3b26d2f7a1d5037dcce6e12e9 to your computer and use it in GitHub Desktop.
Save lotusirous/88dc1db3b26d2f7a1d5037dcce6e12e9 to your computer and use it in GitHub Desktop.
-- Pull in the wezterm API
local wezterm = require("wezterm")
-- This will hold the configuration.
-- local config = wezterm.config_builder()
local act = wezterm.action
-- hyperlinks rules
local hyperlink_rules = wezterm.default_hyperlink_rules()
table.insert(hyperlink_rules, {
regex = [[\b[tt](\d+)\b]],
format = "https://example.com/tasks/?t=$1",
})
-- and finally, return the configuration to wezterm
return {
-- Allow the keyboard to use alt-c
-- https://github.com/wez/wezterm/pull/1096
use_ime = true,
send_composed_key_when_left_alt_is_pressed = true,
send_composed_key_when_right_alt_is_pressed = false,
scrollback_lines = 3500,
enable_scroll_bar = false,
hyperlink_rules = hyperlink_rules,
color_scheme = "Gruvbox Dark (Gogh)",
font = wezterm.font("JetBrains Mono NL", { weight = "Regular", italic = false }),
font_size = 14,
exit_behavior = "Close",
front_end = "Software",
freetype_load_target = "Light",
freetype_render_target = "HorizontalLcd",
cell_width = 0.9,
window_close_confirmation = "NeverPrompt",
initial_rows = 70,
initial_cols = 256,
window_background_opacity = 0.94,
macos_window_background_blur = 20,
window_decorations = "INTEGRATED_BUTTONS|RESIZE",
tab_max_width = 18,
window_padding = {
left = 16,
right = 16,
top = 16,
bottom = 1,
},
font_rules = {
{
intensity = "Half",
italic = true,
font = wezterm.font("JetBrains Mono NL", { weight = "DemiBold", italic = false }),
},
{
intensity = "Bold",
italic = false,
font = wezterm.font("JetBrains Mono NL", { weight = "Bold", italic = false }),
},
{
intensity = "Bold",
italic = true,
font = wezterm.font("JetBrains Mono NL", { weight = "Bold", italic = true }),
},
},
-- enable_tab_bar = false,
leader = { key = "b", mods = "CTRL", timeout_milliseconds = 1000 },
keys = {
{
mods = "LEADER",
key = "-",
action = wezterm.action.SplitVertical({ domain = "CurrentPaneDomain" }),
},
{
mods = "LEADER",
key = '"',
action = wezterm.action.SplitHorizontal({ domain = "CurrentPaneDomain" }),
},
{
mods = "LEADER",
key = "m",
action = wezterm.action.TogglePaneZoomState,
},
-- set active tab
{
key = "h",
mods = "ALT",
action = wezterm.action.ActivateTabRelative(-1),
},
{
key = "l",
mods = "ALT",
action = wezterm.action.ActivateTabRelative(1),
},
-- move window
{
key = "RightArrow",
mods = "ALT",
action = wezterm.action.MoveTabRelative(1),
},
{
key = "LeftArrow",
mods = "ALT",
action = wezterm.action.MoveTabRelative(-1),
},
-- tmux new tab
{
key = "Space",
mods = "LEADER",
action = wezterm.action.QuickSelect,
},
{
key = "c",
mods = "LEADER",
action = wezterm.action.SpawnTab("CurrentPaneDomain"),
},
{
key = ",",
mods = "LEADER",
action = act.PromptInputLine({
description = "Enter new name for tab",
action = wezterm.action_callback(function(window, pane, line)
-- line will be `nil` if they hit escape without entering anything
-- An empty string if they just hit enter
-- Or the actual line of text they wrote
if line then
window:active_tab():set_title(line)
end
end),
}),
},
{ mods = "LEADER", key = "h", action = wezterm.action.ActivatePaneDirection("Left") },
{ mods = "LEADER", key = "j", action = wezterm.action.ActivatePaneDirection("Down") },
{ mods = "LEADER", key = "k", action = wezterm.action.ActivatePaneDirection("Up") },
{ mods = "LEADER", key = "l", action = wezterm.action.ActivatePaneDirection("Right") },
{ key = "UpArrow", mods = "CMD", action = act.ScrollByLine(-10) },
{ key = "DownArrow", mods = "CMD", action = act.ScrollByLine(10) },
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment