Add custom styling to wezterm tab bar, move stylua.toml to top level directory

This commit is contained in:
Evie Litherland-Smith 2023-02-19 12:16:22 +00:00
parent 4c8a1623f0
commit 92c3bcbf7c
7 changed files with 359 additions and 303 deletions

View file

@ -1,81 +1,81 @@
local wezterm = require("wezterm") local wezterm = require "wezterm"
local act = wezterm.action local act = wezterm.action
return { return {
copy_mode = { copy_mode = {
{ key = "Tab", mods = "NONE", action = act.CopyMode("MoveForwardWord") }, { key = "Tab", mods = "NONE", action = act.CopyMode "MoveForwardWord" },
{ key = "Tab", mods = "SHIFT", action = act.CopyMode("MoveBackwardWord") }, { key = "Tab", mods = "SHIFT", action = act.CopyMode "MoveBackwardWord" },
{ key = "Enter", mods = "NONE", action = act.CopyMode("MoveToStartOfNextLine") }, { key = "Enter", mods = "NONE", action = act.CopyMode "MoveToStartOfNextLine" },
{ key = "Escape", mods = "NONE", action = act.CopyMode("Close") }, { key = "Escape", mods = "NONE", action = act.CopyMode "Close" },
{ key = "Space", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) }, { key = "Space", mods = "NONE", action = act.CopyMode { SetSelectionMode = "Cell" } },
{ key = "$", mods = "NONE", action = act.CopyMode("MoveToEndOfLineContent") }, { key = "$", mods = "NONE", action = act.CopyMode "MoveToEndOfLineContent" },
{ key = "$", mods = "SHIFT", action = act.CopyMode("MoveToEndOfLineContent") }, { key = "$", mods = "SHIFT", action = act.CopyMode "MoveToEndOfLineContent" },
{ key = ",", mods = "NONE", action = act.CopyMode("JumpReverse") }, { key = ",", mods = "NONE", action = act.CopyMode "JumpReverse" },
{ key = "0", mods = "NONE", action = act.CopyMode("MoveToStartOfLine") }, { key = "0", mods = "NONE", action = act.CopyMode "MoveToStartOfLine" },
{ key = ";", mods = "NONE", action = act.CopyMode("JumpAgain") }, { key = ";", mods = "NONE", action = act.CopyMode "JumpAgain" },
{ key = "F", mods = "NONE", action = act.CopyMode({ JumpBackward = { prev_char = false } }) }, { key = "F", mods = "NONE", action = act.CopyMode { JumpBackward = { prev_char = false } } },
{ key = "F", mods = "SHIFT", action = act.CopyMode({ JumpBackward = { prev_char = false } }) }, { key = "F", mods = "SHIFT", action = act.CopyMode { JumpBackward = { prev_char = false } } },
{ key = "G", mods = "NONE", action = act.CopyMode("MoveToScrollbackBottom") }, { key = "G", mods = "NONE", action = act.CopyMode "MoveToScrollbackBottom" },
{ key = "G", mods = "SHIFT", action = act.CopyMode("MoveToScrollbackBottom") }, { key = "G", mods = "SHIFT", action = act.CopyMode "MoveToScrollbackBottom" },
{ key = "H", mods = "NONE", action = act.CopyMode("MoveToViewportTop") }, { key = "H", mods = "NONE", action = act.CopyMode "MoveToViewportTop" },
{ key = "H", mods = "SHIFT", action = act.CopyMode("MoveToViewportTop") }, { key = "H", mods = "SHIFT", action = act.CopyMode "MoveToViewportTop" },
{ key = "L", mods = "NONE", action = act.CopyMode("MoveToViewportBottom") }, { key = "L", mods = "NONE", action = act.CopyMode "MoveToViewportBottom" },
{ key = "L", mods = "SHIFT", action = act.CopyMode("MoveToViewportBottom") }, { key = "L", mods = "SHIFT", action = act.CopyMode "MoveToViewportBottom" },
{ key = "M", mods = "NONE", action = act.CopyMode("MoveToViewportMiddle") }, { key = "M", mods = "NONE", action = act.CopyMode "MoveToViewportMiddle" },
{ key = "M", mods = "SHIFT", action = act.CopyMode("MoveToViewportMiddle") }, { key = "M", mods = "SHIFT", action = act.CopyMode "MoveToViewportMiddle" },
{ key = "O", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEndHoriz") }, { key = "O", mods = "NONE", action = act.CopyMode "MoveToSelectionOtherEndHoriz" },
{ key = "O", mods = "SHIFT", action = act.CopyMode("MoveToSelectionOtherEndHoriz") }, { key = "O", mods = "SHIFT", action = act.CopyMode "MoveToSelectionOtherEndHoriz" },
{ key = "T", mods = "NONE", action = act.CopyMode({ JumpBackward = { prev_char = true } }) }, { key = "T", mods = "NONE", action = act.CopyMode { JumpBackward = { prev_char = true } } },
{ key = "T", mods = "SHIFT", action = act.CopyMode({ JumpBackward = { prev_char = true } }) }, { key = "T", mods = "SHIFT", action = act.CopyMode { JumpBackward = { prev_char = true } } },
{ key = "V", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Line" }) }, { key = "V", mods = "NONE", action = act.CopyMode { SetSelectionMode = "Line" } },
{ key = "V", mods = "SHIFT", action = act.CopyMode({ SetSelectionMode = "Line" }) }, { key = "V", mods = "SHIFT", action = act.CopyMode { SetSelectionMode = "Line" } },
{ key = "^", mods = "NONE", action = act.CopyMode("MoveToStartOfLineContent") }, { key = "^", mods = "NONE", action = act.CopyMode "MoveToStartOfLineContent" },
{ key = "^", mods = "SHIFT", action = act.CopyMode("MoveToStartOfLineContent") }, { key = "^", mods = "SHIFT", action = act.CopyMode "MoveToStartOfLineContent" },
{ key = "b", mods = "NONE", action = act.CopyMode("MoveBackwardWord") }, { key = "b", mods = "NONE", action = act.CopyMode "MoveBackwardWord" },
{ key = "b", mods = "ALT", action = act.CopyMode("MoveBackwardWord") }, { key = "b", mods = "ALT", action = act.CopyMode "MoveBackwardWord" },
{ key = "b", mods = "CTRL", action = act.CopyMode("PageUp") }, { key = "b", mods = "CTRL", action = act.CopyMode "PageUp" },
{ key = "c", mods = "CTRL", action = act.CopyMode("Close") }, { key = "c", mods = "CTRL", action = act.CopyMode "Close" },
{ key = "f", mods = "NONE", action = act.CopyMode({ JumpForward = { prev_char = false } }) }, { key = "f", mods = "NONE", action = act.CopyMode { JumpForward = { prev_char = false } } },
{ key = "f", mods = "ALT", action = act.CopyMode("MoveForwardWord") }, { key = "f", mods = "ALT", action = act.CopyMode "MoveForwardWord" },
{ key = "f", mods = "CTRL", action = act.CopyMode("PageDown") }, { key = "f", mods = "CTRL", action = act.CopyMode "PageDown" },
{ key = "g", mods = "NONE", action = act.CopyMode("MoveToScrollbackTop") }, { key = "g", mods = "NONE", action = act.CopyMode "MoveToScrollbackTop" },
{ key = "g", mods = "CTRL", action = act.CopyMode("Close") }, { key = "g", mods = "CTRL", action = act.CopyMode "Close" },
{ key = "h", mods = "NONE", action = act.CopyMode("MoveLeft") }, { key = "h", mods = "NONE", action = act.CopyMode "MoveLeft" },
{ key = "j", mods = "NONE", action = act.CopyMode("MoveDown") }, { key = "j", mods = "NONE", action = act.CopyMode "MoveDown" },
{ key = "k", mods = "NONE", action = act.CopyMode("MoveUp") }, { key = "k", mods = "NONE", action = act.CopyMode "MoveUp" },
{ key = "l", mods = "NONE", action = act.CopyMode("MoveRight") }, { key = "l", mods = "NONE", action = act.CopyMode "MoveRight" },
{ key = "m", mods = "ALT", action = act.CopyMode("MoveToStartOfLineContent") }, { key = "m", mods = "ALT", action = act.CopyMode "MoveToStartOfLineContent" },
{ key = "o", mods = "NONE", action = act.CopyMode("MoveToSelectionOtherEnd") }, { key = "o", mods = "NONE", action = act.CopyMode "MoveToSelectionOtherEnd" },
{ key = "q", mods = "NONE", action = act.CopyMode("Close") }, { key = "q", mods = "NONE", action = act.CopyMode "Close" },
{ key = "t", mods = "NONE", action = act.CopyMode({ JumpForward = { prev_char = true } }) }, { key = "t", mods = "NONE", action = act.CopyMode { JumpForward = { prev_char = true } } },
{ key = "v", mods = "NONE", action = act.CopyMode({ SetSelectionMode = "Cell" }) }, { key = "v", mods = "NONE", action = act.CopyMode { SetSelectionMode = "Cell" } },
{ key = "v", mods = "CTRL", action = act.CopyMode({ SetSelectionMode = "Block" }) }, { key = "v", mods = "CTRL", action = act.CopyMode { SetSelectionMode = "Block" } },
{ key = "w", mods = "NONE", action = act.CopyMode("MoveForwardWord") }, { key = "w", mods = "NONE", action = act.CopyMode "MoveForwardWord" },
{ {
key = "y", key = "y",
mods = "NONE", mods = "NONE",
action = act.Multiple({ { CopyTo = "ClipboardAndPrimarySelection" }, { CopyMode = "Close" } }), action = act.Multiple { { CopyTo = "ClipboardAndPrimarySelection" }, { CopyMode = "Close" } },
}, },
{ key = "PageUp", mods = "NONE", action = act.CopyMode("PageUp") }, { key = "PageUp", mods = "NONE", action = act.CopyMode "PageUp" },
{ key = "PageDown", mods = "NONE", action = act.CopyMode("PageDown") }, { key = "PageDown", mods = "NONE", action = act.CopyMode "PageDown" },
{ key = "LeftArrow", mods = "NONE", action = act.CopyMode("MoveLeft") }, { key = "LeftArrow", mods = "NONE", action = act.CopyMode "MoveLeft" },
{ key = "LeftArrow", mods = "ALT", action = act.CopyMode("MoveBackwardWord") }, { key = "LeftArrow", mods = "ALT", action = act.CopyMode "MoveBackwardWord" },
{ key = "RightArrow", mods = "NONE", action = act.CopyMode("MoveRight") }, { key = "RightArrow", mods = "NONE", action = act.CopyMode "MoveRight" },
{ key = "RightArrow", mods = "ALT", action = act.CopyMode("MoveForwardWord") }, { key = "RightArrow", mods = "ALT", action = act.CopyMode "MoveForwardWord" },
{ key = "UpArrow", mods = "NONE", action = act.CopyMode("MoveUp") }, { key = "UpArrow", mods = "NONE", action = act.CopyMode "MoveUp" },
{ key = "DownArrow", mods = "NONE", action = act.CopyMode("MoveDown") }, { key = "DownArrow", mods = "NONE", action = act.CopyMode "MoveDown" },
}, },
search_mode = { search_mode = {
{ key = "Enter", mods = "NONE", action = act.CopyMode("PriorMatch") }, { key = "Enter", mods = "NONE", action = act.CopyMode "PriorMatch" },
{ key = "Escape", mods = "NONE", action = act.CopyMode("Close") }, { key = "Escape", mods = "NONE", action = act.CopyMode "Close" },
{ key = "n", mods = "CTRL", action = act.CopyMode("NextMatch") }, { key = "n", mods = "CTRL", action = act.CopyMode "NextMatch" },
{ key = "p", mods = "CTRL", action = act.CopyMode("PriorMatch") }, { key = "p", mods = "CTRL", action = act.CopyMode "PriorMatch" },
{ key = "r", mods = "CTRL", action = act.CopyMode("CycleMatchType") }, { key = "r", mods = "CTRL", action = act.CopyMode "CycleMatchType" },
{ key = "u", mods = "CTRL", action = act.CopyMode("ClearPattern") }, { key = "u", mods = "CTRL", action = act.CopyMode "ClearPattern" },
{ key = "PageUp", mods = "NONE", action = act.CopyMode("PriorMatchPage") }, { key = "PageUp", mods = "NONE", action = act.CopyMode "PriorMatchPage" },
{ key = "PageDown", mods = "NONE", action = act.CopyMode("NextMatchPage") }, { key = "PageDown", mods = "NONE", action = act.CopyMode "NextMatchPage" },
{ key = "UpArrow", mods = "NONE", action = act.CopyMode("PriorMatch") }, { key = "UpArrow", mods = "NONE", action = act.CopyMode "PriorMatch" },
{ key = "DownArrow", mods = "NONE", action = act.CopyMode("NextMatch") }, { key = "DownArrow", mods = "NONE", action = act.CopyMode "NextMatch" },
}, },
} }

View file

@ -1,124 +1,124 @@
local wezterm = require("wezterm") local wezterm = require "wezterm"
local act = wezterm.action local act = wezterm.action
return { return {
{ key = "h", mods = "ALT", action = act.EmitEvent("ActivatePaneDirection-left") }, { key = "h", mods = "ALT", action = act.EmitEvent "ActivatePaneDirection-left" },
{ key = "j", mods = "ALT", action = act.EmitEvent("ActivatePaneDirection-down") }, { key = "j", mods = "ALT", action = act.EmitEvent "ActivatePaneDirection-down" },
{ key = "k", mods = "ALT", action = act.EmitEvent("ActivatePaneDirection-up") }, { key = "k", mods = "ALT", action = act.EmitEvent "ActivatePaneDirection-up" },
{ key = "l", mods = "ALT", action = act.EmitEvent("ActivatePaneDirection-right") }, { key = "l", mods = "ALT", action = act.EmitEvent "ActivatePaneDirection-right" },
{ key = "1", mods = "ALT", action = act.ActivateTab(0) }, { key = "1", mods = "ALT", action = act.ActivateTab(0) },
{ key = "2", mods = "ALT", action = act.ActivateTab(1) }, { key = "2", mods = "ALT", action = act.ActivateTab(1) },
{ key = "3", mods = "ALT", action = act.ActivateTab(2) }, { key = "3", mods = "ALT", action = act.ActivateTab(2) },
{ key = "4", mods = "ALT", action = act.ActivateTab(3) }, { key = "4", mods = "ALT", action = act.ActivateTab(3) },
{ key = "5", mods = "ALT", action = act.ActivateTab(4) }, { key = "5", mods = "ALT", action = act.ActivateTab(4) },
{ key = "6", mods = "ALT", action = act.ActivateTab(5) }, { key = "6", mods = "ALT", action = act.ActivateTab(5) },
{ key = "7", mods = "ALT", action = act.ActivateTab(6) }, { key = "7", mods = "ALT", action = act.ActivateTab(6) },
{ key = "8", mods = "ALT", action = act.ActivateTab(7) }, { key = "8", mods = "ALT", action = act.ActivateTab(7) },
{ key = "9", mods = "ALT", action = act.ActivateTab(8) }, { key = "9", mods = "ALT", action = act.ActivateTab(8) },
{ key = "0", mods = "ALT", action = act.ActivateTab(-1) }, { key = "0", mods = "ALT", action = act.ActivateTab(-1) },
{ key = "Enter", mods = "ALT", action = act.SplitVertical({ domain = "CurrentPaneDomain" }) }, { key = "Enter", mods = "ALT", action = act.SplitVertical { domain = "CurrentPaneDomain" } },
{ key = "Enter", mods = "SHIFT|ALT", action = act.SplitHorizontal({ domain = "CurrentPaneDomain" }) }, { key = "Enter", mods = "SHIFT|ALT", action = act.SplitHorizontal { domain = "CurrentPaneDomain" } },
{ key = "Tab", mods = "CTRL", action = act.ActivateTabRelative(1) }, { key = "Tab", mods = "CTRL", action = act.ActivateTabRelative(1) },
{ key = "Tab", mods = "SHIFT|CTRL", action = act.ActivateTabRelative(-1) }, { key = "Tab", mods = "SHIFT|CTRL", action = act.ActivateTabRelative(-1) },
{ key = "Enter", mods = "SUPER", action = act.ToggleFullScreen }, { key = "Enter", mods = "SUPER", action = act.ToggleFullScreen },
{ key = ")", mods = "CTRL", action = act.ResetFontSize }, { key = ")", mods = "CTRL", action = act.ResetFontSize },
{ key = ")", mods = "SHIFT|CTRL", action = act.ResetFontSize }, { key = ")", mods = "SHIFT|CTRL", action = act.ResetFontSize },
{ key = "0", mods = "CTRL", action = act.ResetFontSize }, { key = "0", mods = "CTRL", action = act.ResetFontSize },
{ key = "0", mods = "SHIFT|CTRL", action = act.ResetFontSize }, { key = "0", mods = "SHIFT|CTRL", action = act.ResetFontSize },
{ key = "+", mods = "CTRL", action = act.IncreaseFontSize }, { key = "+", mods = "CTRL", action = act.IncreaseFontSize },
{ key = "+", mods = "SHIFT|CTRL", action = act.IncreaseFontSize }, { key = "+", mods = "SHIFT|CTRL", action = act.IncreaseFontSize },
{ key = "-", mods = "CTRL", action = act.DecreaseFontSize }, { key = "-", mods = "CTRL", action = act.DecreaseFontSize },
{ key = "-", mods = "SHIFT|CTRL", action = act.DecreaseFontSize }, { key = "-", mods = "SHIFT|CTRL", action = act.DecreaseFontSize },
{ key = "=", mods = "CTRL", action = act.IncreaseFontSize }, { key = "=", mods = "CTRL", action = act.IncreaseFontSize },
{ key = "=", mods = "SHIFT|CTRL", action = act.IncreaseFontSize }, { key = "=", mods = "SHIFT|CTRL", action = act.IncreaseFontSize },
{ key = "C", mods = "CTRL", action = act.CopyTo("Clipboard") }, { key = "C", mods = "CTRL", action = act.CopyTo "Clipboard" },
{ key = "C", mods = "SHIFT|CTRL", action = act.CopyTo("Clipboard") }, { key = "C", mods = "SHIFT|CTRL", action = act.CopyTo "Clipboard" },
{ key = "F", mods = "CTRL", action = act.Search("CurrentSelectionOrEmptyString") }, { key = "F", mods = "CTRL", action = act.Search "CurrentSelectionOrEmptyString" },
{ key = "F", mods = "SHIFT|CTRL", action = act.Search("CurrentSelectionOrEmptyString") }, { key = "F", mods = "SHIFT|CTRL", action = act.Search "CurrentSelectionOrEmptyString" },
{ key = "K", mods = "CTRL", action = act.ClearScrollback("ScrollbackOnly") }, { key = "K", mods = "CTRL", action = act.ClearScrollback "ScrollbackOnly" },
{ key = "K", mods = "SHIFT|CTRL", action = act.ClearScrollback("ScrollbackOnly") }, { key = "K", mods = "SHIFT|CTRL", action = act.ClearScrollback "ScrollbackOnly" },
{ key = "L", mods = "CTRL", action = act.ShowDebugOverlay }, { key = "L", mods = "CTRL", action = act.ShowDebugOverlay },
{ key = "L", mods = "SHIFT|CTRL", action = act.ShowDebugOverlay }, { key = "L", mods = "SHIFT|CTRL", action = act.ShowDebugOverlay },
{ key = "M", mods = "CTRL", action = act.Hide }, { key = "M", mods = "CTRL", action = act.Hide },
{ key = "M", mods = "SHIFT|CTRL", action = act.Hide }, { key = "M", mods = "SHIFT|CTRL", action = act.Hide },
{ key = "N", mods = "CTRL", action = act.SpawnWindow }, { key = "N", mods = "CTRL", action = act.SpawnWindow },
{ key = "N", mods = "SHIFT|CTRL", action = act.SpawnWindow }, { key = "N", mods = "SHIFT|CTRL", action = act.SpawnWindow },
{ key = "P", mods = "CTRL", action = act.PaneSelect({ alphabet = "", mode = "Activate" }) }, { key = "P", mods = "CTRL", action = act.PaneSelect { alphabet = "", mode = "Activate" } },
{ key = "P", mods = "SHIFT|CTRL", action = act.PaneSelect({ alphabet = "", mode = "Activate" }) }, { key = "P", mods = "SHIFT|CTRL", action = act.PaneSelect { alphabet = "", mode = "Activate" } },
{ key = "R", mods = "CTRL", action = act.ReloadConfiguration }, { key = "R", mods = "CTRL", action = act.ReloadConfiguration },
{ key = "R", mods = "SHIFT|CTRL", action = act.ReloadConfiguration }, { key = "R", mods = "SHIFT|CTRL", action = act.ReloadConfiguration },
{ key = "T", mods = "CTRL", action = act.SpawnTab("CurrentPaneDomain") }, { key = "T", mods = "CTRL", action = act.SpawnTab "CurrentPaneDomain" },
{ key = "T", mods = "SHIFT|CTRL", action = act.SpawnTab("CurrentPaneDomain") }, { key = "T", mods = "SHIFT|CTRL", action = act.SpawnTab "CurrentPaneDomain" },
{ {
key = "U", key = "U",
mods = "CTRL", mods = "CTRL",
action = act.CharSelect({ copy_on_select = true, copy_to = "ClipboardAndPrimarySelection" }), action = act.CharSelect { copy_on_select = true, copy_to = "ClipboardAndPrimarySelection" },
}, },
{ {
key = "U", key = "U",
mods = "SHIFT|CTRL", mods = "SHIFT|CTRL",
action = act.CharSelect({ copy_on_select = true, copy_to = "ClipboardAndPrimarySelection" }), action = act.CharSelect { copy_on_select = true, copy_to = "ClipboardAndPrimarySelection" },
}, },
{ key = "V", mods = "CTRL", action = act.PasteFrom("Clipboard") }, { key = "V", mods = "CTRL", action = act.PasteFrom "Clipboard" },
{ key = "V", mods = "SHIFT|CTRL", action = act.PasteFrom("Clipboard") }, { key = "V", mods = "SHIFT|CTRL", action = act.PasteFrom "Clipboard" },
{ key = "W", mods = "CTRL", action = act.CloseCurrentTab({ confirm = true }) }, { key = "W", mods = "CTRL", action = act.CloseCurrentTab { confirm = true } },
{ key = "W", mods = "SHIFT|CTRL", action = act.CloseCurrentTab({ confirm = true }) }, { key = "W", mods = "SHIFT|CTRL", action = act.CloseCurrentTab { confirm = true } },
{ key = "X", mods = "CTRL", action = act.ActivateCopyMode }, { key = "X", mods = "CTRL", action = act.ActivateCopyMode },
{ key = "X", mods = "SHIFT|CTRL", action = act.ActivateCopyMode }, { key = "X", mods = "SHIFT|CTRL", action = act.ActivateCopyMode },
{ key = "Z", mods = "CTRL", action = act.TogglePaneZoomState }, { key = "Z", mods = "CTRL", action = act.TogglePaneZoomState },
{ key = "Z", mods = "SHIFT|CTRL", action = act.TogglePaneZoomState }, { key = "Z", mods = "SHIFT|CTRL", action = act.TogglePaneZoomState },
{ key = "[", mods = "SHIFT|SUPER", action = act.ActivateTabRelative(-1) }, { key = "[", mods = "SHIFT|SUPER", action = act.ActivateTabRelative(-1) },
{ key = "]", mods = "SHIFT|SUPER", action = act.ActivateTabRelative(1) }, { key = "]", mods = "SHIFT|SUPER", action = act.ActivateTabRelative(1) },
{ key = "_", mods = "CTRL", action = act.DecreaseFontSize }, { key = "_", mods = "CTRL", action = act.DecreaseFontSize },
{ key = "_", mods = "SHIFT|CTRL", action = act.DecreaseFontSize }, { key = "_", mods = "SHIFT|CTRL", action = act.DecreaseFontSize },
{ key = "c", mods = "SHIFT|CTRL", action = act.CopyTo("Clipboard") }, { key = "c", mods = "SHIFT|CTRL", action = act.CopyTo "Clipboard" },
{ key = "c", mods = "SUPER", action = act.CopyTo("Clipboard") }, { key = "c", mods = "SUPER", action = act.CopyTo "Clipboard" },
{ key = "f", mods = "SHIFT|CTRL", action = act.Search("CurrentSelectionOrEmptyString") }, { key = "f", mods = "SHIFT|CTRL", action = act.Search "CurrentSelectionOrEmptyString" },
{ key = "f", mods = "SUPER", action = act.Search("CurrentSelectionOrEmptyString") }, { key = "f", mods = "SUPER", action = act.Search "CurrentSelectionOrEmptyString" },
{ key = "k", mods = "SHIFT|CTRL", action = act.ClearScrollback("ScrollbackOnly") }, { key = "k", mods = "SHIFT|CTRL", action = act.ClearScrollback "ScrollbackOnly" },
{ key = "k", mods = "SUPER", action = act.ClearScrollback("ScrollbackOnly") }, { key = "k", mods = "SUPER", action = act.ClearScrollback "ScrollbackOnly" },
{ key = "l", mods = "SHIFT|CTRL", action = act.ShowDebugOverlay }, { key = "l", mods = "SHIFT|CTRL", action = act.ShowDebugOverlay },
{ key = "m", mods = "SHIFT|CTRL", action = act.Hide }, { key = "m", mods = "SHIFT|CTRL", action = act.Hide },
{ key = "m", mods = "SUPER", action = act.Hide }, { key = "m", mods = "SUPER", action = act.Hide },
{ key = "n", mods = "SHIFT|CTRL", action = act.SpawnWindow }, { key = "n", mods = "SHIFT|CTRL", action = act.SpawnWindow },
{ key = "n", mods = "SUPER", action = act.SpawnWindow }, { key = "n", mods = "SUPER", action = act.SpawnWindow },
{ key = "p", mods = "SHIFT|CTRL", action = act.PaneSelect({ alphabet = "", mode = "Activate" }) }, { key = "p", mods = "SHIFT|CTRL", action = act.PaneSelect { alphabet = "", mode = "Activate" } },
{ key = "r", mods = "SHIFT|CTRL", action = act.ReloadConfiguration }, { key = "r", mods = "SHIFT|CTRL", action = act.ReloadConfiguration },
{ key = "r", mods = "SUPER", action = act.ReloadConfiguration }, { key = "r", mods = "SUPER", action = act.ReloadConfiguration },
{ key = "t", mods = "SHIFT|CTRL", action = act.SpawnTab("CurrentPaneDomain") }, { key = "t", mods = "SHIFT|CTRL", action = act.SpawnTab "CurrentPaneDomain" },
{ key = "t", mods = "SUPER", action = act.SpawnTab("CurrentPaneDomain") }, { key = "t", mods = "SUPER", action = act.SpawnTab "CurrentPaneDomain" },
{ {
key = "u", key = "u",
mods = "SHIFT|CTRL", mods = "SHIFT|CTRL",
action = act.CharSelect({ copy_on_select = true, copy_to = "ClipboardAndPrimarySelection" }), action = act.CharSelect { copy_on_select = true, copy_to = "ClipboardAndPrimarySelection" },
}, },
{ key = "v", mods = "SHIFT|CTRL", action = act.PasteFrom("Clipboard") }, { key = "v", mods = "SHIFT|CTRL", action = act.PasteFrom "Clipboard" },
{ key = "v", mods = "SUPER", action = act.PasteFrom("Clipboard") }, { key = "v", mods = "SUPER", action = act.PasteFrom "Clipboard" },
{ key = "w", mods = "SHIFT|CTRL", action = act.CloseCurrentTab({ confirm = true }) }, { key = "w", mods = "SHIFT|CTRL", action = act.CloseCurrentTab { confirm = true } },
{ key = "w", mods = "SUPER", action = act.CloseCurrentTab({ confirm = true }) }, { key = "w", mods = "SUPER", action = act.CloseCurrentTab { confirm = true } },
{ key = "x", mods = "SHIFT|CTRL", action = act.ActivateCopyMode }, { key = "x", mods = "SHIFT|CTRL", action = act.ActivateCopyMode },
{ key = "z", mods = "SHIFT|CTRL", action = act.TogglePaneZoomState }, { key = "z", mods = "SHIFT|CTRL", action = act.TogglePaneZoomState },
{ key = "{", mods = "SUPER", action = act.ActivateTabRelative(-1) }, { key = "{", mods = "SUPER", action = act.ActivateTabRelative(-1) },
{ key = "{", mods = "SHIFT|SUPER", action = act.ActivateTabRelative(-1) }, { key = "{", mods = "SHIFT|SUPER", action = act.ActivateTabRelative(-1) },
{ key = "}", mods = "SUPER", action = act.ActivateTabRelative(1) }, { key = "}", mods = "SUPER", action = act.ActivateTabRelative(1) },
{ key = "}", mods = "SHIFT|SUPER", action = act.ActivateTabRelative(1) }, { key = "}", mods = "SHIFT|SUPER", action = act.ActivateTabRelative(1) },
{ key = "phys:Space", mods = "SHIFT|CTRL", action = act.QuickSelect }, { key = "phys:Space", mods = "SHIFT|CTRL", action = act.QuickSelect },
{ key = "PageUp", mods = "SHIFT", action = act.ScrollByPage(-1) }, { key = "PageUp", mods = "SHIFT", action = act.ScrollByPage(-1) },
{ key = "PageUp", mods = "CTRL", action = act.ActivateTabRelative(-1) }, { key = "PageUp", mods = "CTRL", action = act.ActivateTabRelative(-1) },
{ key = "PageUp", mods = "SHIFT|CTRL", action = act.MoveTabRelative(-1) }, { key = "PageUp", mods = "SHIFT|CTRL", action = act.MoveTabRelative(-1) },
{ key = "PageDown", mods = "SHIFT", action = act.ScrollByPage(1) }, { key = "PageDown", mods = "SHIFT", action = act.ScrollByPage(1) },
{ key = "PageDown", mods = "CTRL", action = act.ActivateTabRelative(1) }, { key = "PageDown", mods = "CTRL", action = act.ActivateTabRelative(1) },
{ key = "PageDown", mods = "SHIFT|CTRL", action = act.MoveTabRelative(1) }, { key = "PageDown", mods = "SHIFT|CTRL", action = act.MoveTabRelative(1) },
{ key = "LeftArrow", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection("Left") }, { key = "LeftArrow", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection "Left" },
{ key = "LeftArrow", mods = "SHIFT|ALT|CTRL", action = act.AdjustPaneSize({ "Left", 1 }) }, { key = "LeftArrow", mods = "SHIFT|ALT|CTRL", action = act.AdjustPaneSize { "Left", 1 } },
{ key = "RightArrow", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection("Right") }, { key = "RightArrow", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection "Right" },
{ key = "RightArrow", mods = "SHIFT|ALT|CTRL", action = act.AdjustPaneSize({ "Right", 1 }) }, { key = "RightArrow", mods = "SHIFT|ALT|CTRL", action = act.AdjustPaneSize { "Right", 1 } },
{ key = "UpArrow", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection("Up") }, { key = "UpArrow", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection "Up" },
{ key = "UpArrow", mods = "SHIFT|ALT|CTRL", action = act.AdjustPaneSize({ "Up", 1 }) }, { key = "UpArrow", mods = "SHIFT|ALT|CTRL", action = act.AdjustPaneSize { "Up", 1 } },
{ key = "DownArrow", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection("Down") }, { key = "DownArrow", mods = "SHIFT|CTRL", action = act.ActivatePaneDirection "Down" },
{ key = "DownArrow", mods = "SHIFT|ALT|CTRL", action = act.AdjustPaneSize({ "Down", 1 }) }, { key = "DownArrow", mods = "SHIFT|ALT|CTRL", action = act.AdjustPaneSize { "Down", 1 } },
{ key = "Insert", mods = "SHIFT", action = act.PasteFrom("PrimarySelection") }, { key = "Insert", mods = "SHIFT", action = act.PasteFrom "PrimarySelection" },
{ key = "Insert", mods = "CTRL", action = act.CopyTo("PrimarySelection") }, { key = "Insert", mods = "CTRL", action = act.CopyTo "PrimarySelection" },
{ key = "Copy", mods = "NONE", action = act.CopyTo("Clipboard") }, { key = "Copy", mods = "NONE", action = act.CopyTo "Clipboard" },
{ key = "Paste", mods = "NONE", action = act.PasteFrom("Clipboard") }, { key = "Paste", mods = "NONE", action = act.PasteFrom "Clipboard" },
} }

View file

@ -1,35 +1,30 @@
local wezterm = require("wezterm") local wezterm = require "wezterm"
local act = wezterm.action local act = wezterm.action
local function isViProcess(pane) local function isViProcess(pane)
-- get_foreground_process_name On Linux, macOS and Windows, -- get_foreground_process_name On Linux, macOS and Windows,
-- the process can be queried to determine this path. Other operating systems -- the process can be queried to determine this path. Other operating systems
-- (notably, FreeBSD and other unix systems) are not currently supported -- (notably, FreeBSD and other unix systems) are not currently supported
return pane:get_foreground_process_name():find("n?vim") ~= nil return pane:get_foreground_process_name():find "n?vim" ~= nil
-- return pane:get_title():find("n?vim") ~= nil -- return pane:get_title():find("n?vim") ~= nil
end end
local function conditionalActivatePane(window, pane, pane_direction, vim_direction) local function conditionalActivatePane(window, pane, pane_direction, vim_direction)
if isViProcess(pane) then if isViProcess(pane) then
window:perform_action( window:perform_action(
-- This should match the keybinds you set in Neovim. -- This should match the keybinds you set in Neovim.
act.SendKey({ key = vim_direction, mods = "ALT" }), act.SendKey { key = vim_direction, mods = "ALT" },
pane pane
) )
else else
window:perform_action(act.ActivatePaneDirection(pane_direction), pane) window:perform_action(act.ActivatePaneDirection(pane_direction), pane)
end end
end end
wezterm.on("ActivatePaneDirection-right", function(window, pane) wezterm.on(
conditionalActivatePane(window, pane, "Right", "l") "ActivatePaneDirection-right",
end) function(window, pane) conditionalActivatePane(window, pane, "Right", "l") end
wezterm.on("ActivatePaneDirection-left", function(window, pane) )
conditionalActivatePane(window, pane, "Left", "h") wezterm.on("ActivatePaneDirection-left", function(window, pane) conditionalActivatePane(window, pane, "Left", "h") end)
end) wezterm.on("ActivatePaneDirection-up", function(window, pane) conditionalActivatePane(window, pane, "Up", "k") end)
wezterm.on("ActivatePaneDirection-up", function(window, pane) wezterm.on("ActivatePaneDirection-down", function(window, pane) conditionalActivatePane(window, pane, "Down", "j") end)
conditionalActivatePane(window, pane, "Up", "k")
end)
wezterm.on("ActivatePaneDirection-down", function(window, pane)
conditionalActivatePane(window, pane, "Down", "j")
end)

View file

@ -1,79 +1,75 @@
local wezterm = require("wezterm") local wezterm = require "wezterm"
-- Equivalent to POSIX basename(3) -- The filled in variant of the powerline ( symbol
-- Given "/foo/bar" returns "bar" local SOLID_LEFT_SEP = require("utf8").char(0xe0b6)
-- Given "c:\\foo\\bar" returns "bar"
-- function basename(s)
-- return string.gsub(s, "(.*[/\\])(.*)", "%2")
-- end
wezterm.on("update-right-status", function(window, _) local M = {}
local scheme = wezterm.color.get_builtin_schemes()["Catppuccin Macchiato"] M.setup = function(scheme)
-- Each element holds the text for a cell in a "powerline" style << fade wezterm.on("update-right-status", function(window, _)
local cells = {} -- Each element holds the text for a cell in a "powerline" style << fade
local cells = {}
-- Show current active key table -- Show current active key table
local name = window:active_key_table() local name = window:active_key_table()
if name then if name then
name = "TABLE: " .. name name = "TABLE: " .. name
table.insert(cells, name) table.insert(cells, name)
end end
-- I like my date/time in this style: "Wed Mar 3 08:14" -- I like my date/time in this style: "Wed Mar 3 08:14"
-- local date = wezterm.strftime("%a %b %-d %H:%M") -- local date = wezterm.strftime("%a %b %-d %H:%M")
local date = wezterm.strftime("%Y-%m-%d") local date = wezterm.strftime "%Y-%m-%d"
table.insert(cells, date) table.insert(cells, date)
local time = wezterm.strftime("%H:%M") local time = wezterm.strftime "%H:%M"
table.insert(cells, time) table.insert(cells, time)
-- Get current hostname to track which device I'm on -- Get current hostname to track which device I'm on
table.insert(cells, wezterm.hostname()) table.insert(cells, wezterm.hostname())
-- An entry for each battery (typically 0 or 1 battery) -- An entry for each battery (typically 0 or 1 battery)
for _, b in ipairs(wezterm.battery_info()) do for _, b in ipairs(wezterm.battery_info()) do
table.insert(cells, string.format("%.0f%%", b.state_of_charge * 100)) table.insert(cells, string.format("%.0f%%", b.state_of_charge * 100))
end end
-- The filled in variant of the powerline ( symbol -- Foreground color for the text across the fade
local SOLID_LEFT_SEP = require("utf8").char(0xe0b6) local text_fg = scheme.tab_bar.active_tab.fg_color
-- Tab bar background to complete fade
local tab_bar_bg = scheme.tab_bar.background
-- Color palette for the backgrounds of each cell
local colours = wezterm.color.gradient({
colors = {
scheme.tab_bar.inactive_tab.bg_color,
scheme.tab_bar.active_tab.bg_color,
},
}, #cells + 1)
-- Foreground color for the text across the fade -- The elements to be formatted
local text_fg = scheme.foreground local elements = {}
-- Fancy tab bar background colour to complete fade -- How many cells have been formatted
local fancy_tab_bar_bg = "#333333" local num_cells = 0
-- Color palette for the backgrounds of each cell
local colours = wezterm.color.gradient({
colors = {
scheme.tab_bar.background,
scheme.ansi[1],
},
}, #cells)
-- The elements to be formatted -- Translate a cell into elements
local elements = {} local function push(text, is_last)
-- How many cells have been formatted local cell_no = num_cells + 1
local num_cells = 0 table.insert(elements, { Foreground = { Color = text_fg } })
table.insert(elements, { Background = { Color = colours[cell_no + 1] } })
table.insert(elements, { Text = text })
if not is_last then
table.insert(elements, { Foreground = { Color = colours[cell_no + 2] } })
table.insert(elements, { Text = " " .. SOLID_LEFT_SEP })
end
num_cells = num_cells + 1
end
-- Translate a cell into elements table.insert(elements, { Foreground = { Color = colours[num_cells + 2] } })
local function push(text, is_last) table.insert(elements, { Background = { Color = tab_bar_bg } })
local cell_no = num_cells + 1 table.insert(elements, { Text = SOLID_LEFT_SEP })
table.insert(elements, { Foreground = { Color = text_fg } }) while #cells > 0 do
table.insert(elements, { Background = { Color = colours[cell_no] } }) local cell = table.remove(cells, 1)
table.insert(elements, { Text = text .. " " }) push(cell, #cells == 0)
if not is_last then end
table.insert(elements, { Foreground = { Color = colours[cell_no + 1] } })
table.insert(elements, { Text = SOLID_LEFT_SEP })
end
num_cells = num_cells + 1
end
table.insert(elements, { Foreground = { Color = colours[num_cells + 1] } }) window:set_right_status(wezterm.format(elements))
table.insert(elements, { Background = { Color = fancy_tab_bar_bg } }) end)
table.insert(elements, { Text = SOLID_LEFT_SEP }) end
while #cells > 0 do return M
local cell = table.remove(cells, 1)
push(cell, #cells == 0)
end
window:set_right_status(wezterm.format(elements))
end)

View file

@ -0,0 +1,59 @@
local wezterm = require "wezterm"
-- The filled in variant of the powerline ) symbol
local SOLID_RIGHT_SEP = require("utf8").char(0xe0b4)
local M = {}
M.setup = function(scheme)
wezterm.on("format-tab-title", function(tab, tabs, _, _, hover, max_width)
local text_fg
if tab.is_active then
text_fg = scheme.tab_bar.active_tab.fg_color
else
text_fg = scheme.tab_bar.inactive_tab.fg_color
end
local title = wezterm.truncate_right(tab.active_pane.title, max_width - 2)
local colours = wezterm.color.gradient({
colors = { scheme.tab_bar.active_tab.bg_color, scheme.tab_bar.new_tab.bg_color },
}, #tabs + 1)
local elements = {}
table.insert(elements, "ResetAttributes")
if tab.is_active then
table.insert(elements, { Attribute = { Underline = "Single" } })
table.insert(elements, { Attribute = { Intensity = "Bold" } })
end
if hover then table.insert(elements, { Attribute = { Italic = true } }) end
table.insert(elements, { Background = { Color = colours[tab.tab_index + 1] } })
table.insert(elements, { Foreground = { Color = text_fg } })
table.insert(elements, { Text = " " .. title })
table.insert(elements, "ResetAttributes")
table.insert(elements, { Background = { Color = colours[tab.tab_index + 2] } })
table.insert(elements, { Foreground = { Color = colours[tab.tab_index + 1] } })
table.insert(elements, { Text = SOLID_RIGHT_SEP })
table.insert(elements, "ResetAttributes")
return elements
end)
end
M._new_tab_format = function(scheme)
return {
{ Background = { Color = scheme.tab_bar.new_tab.bg_color } },
{ Foreground = { Color = scheme.tab_bar.new_tab.fg_color } },
{ Text = " +" },
"ResetAttributes",
{ Background = { Color = scheme.tab_bar.background } },
{ Foreground = { Color = scheme.tab_bar.new_tab.bg_color } },
{ Text = SOLID_RIGHT_SEP },
"ResetAttributes",
}
end
M.new_tab = function(scheme) return wezterm.format(M._new_tab_format(scheme)) end
M.new_tab_hover = function(scheme)
local format = M._new_tab_format(scheme)
table.insert(format, 1, { Attribute = { Italic = true } })
return wezterm.format(format)
end
return M

View file

@ -1,15 +1,21 @@
require("status") local wezterm = require "wezterm"
require("navigator") local tab_bar_style = require "tab_bar_style"
local scheme_name = "Catppuccin Macchiato"
local scheme = wezterm.color.get_builtin_schemes()[scheme_name]
tab_bar_style.setup(scheme)
require("status").setup(scheme)
require "navigator"
return { return {
font_size = 14, font_size = 14,
window_background_opacity = 0.95, window_background_opacity = 0.95,
window_decorations = "RESIZE", window_decorations = "RESIZE",
-- use_fancy_tab_bar = false, color_scheme = scheme_name,
color_scheme = "Catppuccin Macchiato", use_fancy_tab_bar = false,
-- color_scheme = "nightfox", tab_max_width = 64,
disable_default_key_bindings = true, tab_bar_style = { new_tab = tab_bar_style.new_tab(scheme), new_tab_hover = tab_bar_style.new_tab_hover(scheme) },
keys = require("keys"), disable_default_key_bindings = true,
key_tables = require("key_tables"), keys = require "keys",
use_dead_keys = false, key_tables = require "key_tables",
use_dead_keys = false,
} }