dotfiles/.config/wezterm/wezterm.lua

245 lines
7.1 KiB
Lua
Raw Normal View History

2022-12-03 14:42:03 +01:00
local wezterm = require("wezterm")
2023-03-07 10:42:16 +01:00
local mux = wezterm.mux
local act = wezterm.action
2021-04-01 16:02:19 +02:00
2023-03-07 16:53:50 +01:00
local function font_with_fallback(name, params)
2023-03-07 10:42:16 +01:00
local names = { name, "Noto Color Emoji" }
2022-12-03 14:42:03 +01:00
return wezterm.font_with_fallback(names, params)
2021-04-01 16:02:19 +02:00
end
2023-03-07 16:53:50 +01:00
wezterm.on("gui-startup", function(cmd)
2023-03-12 19:44:30 +01:00
local args = {}
if cmd then
args = cmd.args
end
2023-03-08 20:58:53 +01:00
2023-03-12 19:44:30 +01:00
local _, _, window = mux.spawn_window({
workspace = "local",
args = args,
2023-03-08 20:58:53 +01:00
})
2023-03-12 19:44:30 +01:00
-- spawn 10 tabs
for _ = 1, 10 do
window:spawn_tab({})
end
2023-03-08 20:58:53 +01:00
2023-03-12 19:44:30 +01:00
mux.set_active_workspace("local")
2023-03-07 16:53:50 +01:00
end)
2023-03-07 10:42:16 +01:00
wezterm.on("mux-startup", function()
2023-03-12 19:44:30 +01:00
local _, _, window = mux.spawn_window({
2023-03-08 20:58:53 +01:00
workspace = "dln-dev",
})
2023-03-12 19:44:30 +01:00
-- Spawn 10 mux tabs (on dev server)
for _ = 1, 10 do
window:spawn_tab({})
end
2023-03-07 10:42:16 +01:00
end)
2023-01-27 09:46:22 +01:00
2023-03-07 10:42:16 +01:00
local is_server = wezterm.hostname() == "dln-dev"
2023-03-08 22:59:58 +01:00
local function activate_nvim(window, pane)
wezterm.log_info("activate_nvim")
for _, t in ipairs(window:mux_window():tabs_with_info()) do
for _, p in ipairs(t.tab:panes()) do
if p:get_title() == "nvim" then
window:perform_action(
act.Multiple({
act.ActivateTab(t.index),
act.MoveTab(0),
}),
pane
)
return
end
end
end
end
wezterm.on("user-var-changed", function(window, pane, name, value)
wezterm.log_info("user-var-changed", name, value)
if name == "nvim_activate" then
2023-03-08 22:59:58 +01:00
activate_nvim(window, pane)
end
end)
2023-03-12 19:44:30 +01:00
local function activate_tab(index)
2023-03-08 22:59:58 +01:00
return function(window, pane)
2023-03-12 19:44:30 +01:00
window:perform_action(act.ActivateTab(index), pane)
-- wezterm.log_info(title)
-- for _, t in ipairs(window:mux_window():tabs_with_info()) do
-- if t.tab:get_title() == title then
-- window:perform_action(
-- act.Multiple({
-- act.ActivateTab(t.index),
-- act.MoveTab(index),
-- }),
-- pane
-- )
-- return
-- end
-- end
-- local tab, _, _ = window:mux_window():spawn_tab({})
-- tab:set_title(title)
-- window:perform_action(act.MoveTab(index), pane)
end
2023-03-08 22:59:58 +01:00
end
wezterm.on("tab-1", activate_nvim)
2023-03-12 19:44:30 +01:00
wezterm.on("tab-2", activate_tab(1))
wezterm.on("tab-3", activate_tab(2))
wezterm.on("tab-4", activate_tab(3))
wezterm.on("tab-5", activate_tab(4))
wezterm.on("tab-6", activate_tab(5))
wezterm.on("tab-7", activate_tab(6))
wezterm.on("tab-8", activate_tab(7))
wezterm.on("tab-9", activate_tab(8))
wezterm.on("tab-10", activate_tab(9))
2023-03-09 18:11:46 +01:00
wezterm.add_to_config_reload_watch_list("/home/dln/.config/shelman-theme/current/wezterm")
2021-04-01 16:02:19 +02:00
return {
2023-03-09 18:11:46 +01:00
color_scheme = "Shelman Theme",
color_scheme_dirs = {
"/home/dln/.config/shelman-theme/current/wezterm",
},
2022-12-06 17:19:07 +01:00
font = font_with_fallback("Iosevka Shelman SS09", { weight = "Regular" }),
2022-12-03 14:42:03 +01:00
font_rules = {
{
italic = false,
intensity = "Half",
2022-12-06 17:19:07 +01:00
font = font_with_fallback("Iosevka Shelman SS09", { weight = "Thin" }),
2022-12-03 14:42:03 +01:00
},
{
italic = true,
intensity = "Normal",
2022-12-06 17:19:07 +01:00
font = font_with_fallback("Iosevka Shelman Curly Slab", { weight = "Light", italic = true }),
2022-12-03 14:42:03 +01:00
},
{
italic = true,
intensity = "Bold",
2022-12-06 17:19:07 +01:00
font = font_with_fallback("Iosevka Shelman SS15", { weight = "ExtraLight", italic = true }),
2022-12-03 14:42:03 +01:00
},
{
intensity = "Bold",
2022-12-06 17:19:07 +01:00
font = font_with_fallback("Iosevka Shelman SS09", { weight = "DemiBold" }),
2022-12-03 14:42:03 +01:00
},
},
freetype_load_target = "Light",
2022-12-06 17:19:07 +01:00
freetype_render_target = "HorizontalLcd",
--freetype_load_flags = "NO_HINTING",
--custom_block_glyphs = false,
2022-12-03 14:42:03 +01:00
warn_about_missing_glyphs = false,
bold_brightens_ansi_colors = false,
2022-12-06 17:19:07 +01:00
allow_square_glyphs_to_overflow_width = "Always",
2023-03-07 10:42:16 +01:00
font_size = 13.5,
2023-03-24 09:19:10 +01:00
command_palette_font_size = 13.5,
2022-12-06 17:19:07 +01:00
line_height = 1.0,
2023-03-07 10:42:16 +01:00
cell_width = 0.95,
2023-03-09 18:11:07 +01:00
initial_cols = 132,
initial_rows = 45,
2023-03-07 10:42:16 +01:00
use_resize_increments = true,
window_background_opacity = 1.0,
2023-01-27 09:46:22 +01:00
window_padding = {
2023-03-07 10:42:16 +01:00
left = "0.75cell",
right = "0.5cell",
top = "0.25cell",
bottom = "0cell",
},
colors = {
tab_bar = {
active_tab = {
fg_color = "#e0e0e0",
bg_color = "#374f66",
},
},
2023-01-27 09:46:22 +01:00
},
2022-12-06 17:19:07 +01:00
window_decorations = "RESIZE",
window_frame = {
border_left_width = "2px",
border_right_width = "2px",
border_bottom_height = "2px",
border_top_height = "2px",
2023-03-07 10:42:16 +01:00
border_left_color = "#333333",
border_right_color = "#333333",
border_bottom_color = "#333333",
border_top_color = "#333333",
inactive_titlebar_bg = "#21262e",
active_titlebar_bg = "#252b34",
2022-12-03 14:42:03 +01:00
},
default_cursor_style = "SteadyBlock",
cursor_thickness = "3px",
2023-01-27 09:46:22 +01:00
cursor_blink_rate = 300,
2022-12-03 14:42:03 +01:00
enable_wayland = true,
2023-03-12 19:44:30 +01:00
enable_tab_bar = true,
2022-12-03 14:42:03 +01:00
tab_bar_at_bottom = true,
2023-03-07 10:42:16 +01:00
use_fancy_tab_bar = true,
2022-12-03 14:42:03 +01:00
show_tab_index_in_tab_bar = true,
enable_scroll_bar = false,
scrollback_lines = 5000,
2023-03-09 18:11:07 +01:00
alternate_buffer_wheel_scroll_speed = 1,
2022-12-03 14:42:03 +01:00
check_for_updates = false,
status_update_interval = 100,
audible_bell = "Disabled",
term = "wezterm",
disable_default_key_bindings = true,
keys = {
2023-03-24 09:19:10 +01:00
{ key = "c", mods = "ALT|SHIFT", action = act.CopyTo("ClipboardAndPrimarySelection") },
{ key = "v", mods = "ALT|SHIFT", action = act.PasteFrom("PrimarySelection") },
2022-12-03 14:42:03 +01:00
{ key = "0", mods = "CTRL", action = "ResetFontSize" },
{ key = "-", mods = "CTRL", action = "DecreaseFontSize" },
{ key = "=", mods = "CTRL", action = "IncreaseFontSize" },
{ key = "Enter", mods = "ALT", action = "ToggleFullScreen" },
2023-03-07 10:42:16 +01:00
{ key = "r", mods = "ALT", action = act.ReloadConfiguration },
-- mux
2023-03-12 19:44:30 +01:00
{ key = "A", mods = "ALT", action = act.AttachDomain("dln-dev") },
{ key = "E", mods = "ALT", action = act.DetachDomain({ DomainName = "dln-dev" }) },
2023-03-08 22:59:58 +01:00
{ key = "1", mods = "ALT", action = act.EmitEvent("tab-1") },
{ key = "2", mods = "ALT", action = act.EmitEvent("tab-2") },
{ key = "3", mods = "ALT", action = act.EmitEvent("tab-3") },
{ key = "4", mods = "ALT", action = act.EmitEvent("tab-4") },
{ key = "5", mods = "ALT", action = act.EmitEvent("tab-5") },
{ key = "6", mods = "ALT", action = act.EmitEvent("tab-6") },
{ key = "7", mods = "ALT", action = act.EmitEvent("tab-7") },
{ key = "8", mods = "ALT", action = act.EmitEvent("tab-8") },
{ key = "9", mods = "ALT", action = act.EmitEvent("tab-9") },
{ key = "0", mods = "ALT", action = act.EmitEvent("tab-10") },
{ key = "RightArrow", mods = "CTRL", action = act.ActivateTabRelative(1) },
{ key = "LeftArrow", mods = "CTRL", action = act.ActivateTabRelative(-1) },
2023-03-24 09:19:10 +01:00
{ key = "l", mods = "ALT", action = wezterm.action.ActivateCommandPalette },
2023-03-08 20:58:53 +01:00
{ key = "Backspace", mods = "ALT", action = act.SwitchWorkspaceRelative(1) },
2023-03-09 18:11:07 +01:00
{ key = "UpArrow", mods = "SHIFT", action = act.ScrollByLine(-1) },
{ key = "DownArrow", mods = "SHIFT", action = act.ScrollByLine(1) },
{ key = "PageUp", mods = "SHIFT", action = act.ScrollByPage(-0.5) },
{ key = "PageDown", mods = "SHIFT", action = act.ScrollByPage(0.5) },
},
mouse_bindings = {
{
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
mods = "SHIFT",
action = act.ScrollByLine(-1),
},
{
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
mods = "SHIFT",
action = act.ScrollByLine(1),
},
{
event = { Down = { streak = 1, button = { WheelUp = 1 } } },
action = act.ScrollByPage(-0.25),
},
{
event = { Down = { streak = 1, button = { WheelDown = 1 } } },
action = act.ScrollByPage(0.25),
},
2023-03-07 10:42:16 +01:00
},
unix_domains = {
{
name = "dln-dev",
local_echo_threshold_ms = 100,
2023-03-07 16:53:50 +01:00
proxy_command = is_server == false and { "ssh", "dln-dev", "wezterm", "cli", "proxy" } or nil,
2023-03-07 10:42:16 +01:00
},
2022-12-03 14:42:03 +01:00
},
2021-04-01 16:02:19 +02:00
}