style: enhance tab bar with new separators and themes
This commit is contained in:
@@ -8,9 +8,11 @@ local M = {}
|
||||
CONFIG.hyperlink_rules = WEZTERM.default_hyperlink_rules()
|
||||
|
||||
-- Add support for GitHub link style
|
||||
|
||||
table.insert(CONFIG.hyperlink_rules, {
|
||||
regex = [[["]?([\w\d]{1}[-\w\d]+)(/){1}([-\w\d\.]+)["]?]],
|
||||
format = "https://www.github.com/$1/$3",
|
||||
regex = [["([a-zA-Z0-9_\-]+/[a-zA-Z0-9_\-\.]+)"]],
|
||||
format = "https://www.github.com/$1",
|
||||
highlight = 1,
|
||||
})
|
||||
|
||||
-- make Jira IDs clickable
|
||||
|
||||
@@ -8,7 +8,7 @@ local M = {}
|
||||
RESURRECT = WEZTERM.plugin.require("https://github.com/MLFlexer/resurrect.wezterm")
|
||||
|
||||
-- Set the periodic save interval
|
||||
RESURRECT.periodic_save(60)
|
||||
RESURRECT.periodic_save({ interval_seconds = 60, save_workspaces = true, save_windows = true })
|
||||
|
||||
-- load the state whenever I create a new workspace
|
||||
WEZTERM.on("smart_workspace_switcher.workspace_switcher.created", function(window, _, label)
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
local wezterm = WEZTERM
|
||||
local config = CONFIG
|
||||
local types = require("types")
|
||||
local funcs = require("funcs")
|
||||
|
||||
local tabline = wezterm.plugin.require("https://github.com/michaelbrusegard/tabline.wez")
|
||||
|
||||
tabline.setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "Catppuccin Mocha",
|
||||
section_separators = {
|
||||
left = wezterm.nerdfonts.ple_right_half_circle_thick,
|
||||
right = wezterm.nerdfonts.ple_left_half_circle_thick,
|
||||
},
|
||||
component_separators = {
|
||||
left = wezterm.nerdfonts.ple_right_half_circle_thin,
|
||||
right = wezterm.nerdfonts.ple_left_half_circle_thin,
|
||||
},
|
||||
tab_separators = {
|
||||
left = wezterm.nerdfonts.ple_right_half_circle_thick,
|
||||
right = wezterm.nerdfonts.ple_left_half_circle_thick,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
tabline_a = {
|
||||
funcs.leader_component,
|
||||
{ "mode", padding = { left = 1, right = 0 } },
|
||||
},
|
||||
tabline_b = { { "workspace", padding = { left = 1, right = 0 } } },
|
||||
tabline_c = { " " },
|
||||
tab_active = {
|
||||
{
|
||||
"zoomed",
|
||||
icon = wezterm.nerdfonts.oct_zoom_in,
|
||||
padding = { left = 0, right = 0 },
|
||||
},
|
||||
{
|
||||
"index",
|
||||
fmt = function(n, _)
|
||||
return funcs.ordinal(n)
|
||||
end,
|
||||
padding = { left = 0, right = 0 },
|
||||
},
|
||||
wezterm.nerdfonts.ple_right_half_circle_thin,
|
||||
{
|
||||
"tab",
|
||||
fmt = function(str)
|
||||
return funcs.format_tab_title(str)
|
||||
end,
|
||||
padding = { left = 0, right = 0 },
|
||||
icons_enabled = false,
|
||||
},
|
||||
{ "parent", padding = { left = 0, right = 0 } },
|
||||
"/",
|
||||
{ "cwd", padding = { left = 0, right = 1 } },
|
||||
wezterm.nerdfonts.ple_left_half_circle_thin,
|
||||
{ "process", padding = { left = 0, right = 0 } },
|
||||
},
|
||||
tab_inactive = {
|
||||
{
|
||||
"zoomed",
|
||||
icon = wezterm.nerdfonts.oct_zoom_in,
|
||||
padding = { left = 0, right = 0 },
|
||||
},
|
||||
{
|
||||
"index",
|
||||
fmt = function(n, _)
|
||||
return funcs.ordinal(n)
|
||||
end,
|
||||
padding = { left = 0, right = 0 },
|
||||
},
|
||||
":",
|
||||
{
|
||||
"tab",
|
||||
fmt = function(str)
|
||||
return funcs.format_inactive_tab_title(str)
|
||||
end,
|
||||
padding = { left = 1, right = 0 },
|
||||
icons_enabled = false,
|
||||
},
|
||||
{ "parent", padding = { left = 0, right = 0 } },
|
||||
"/",
|
||||
{ "cwd", padding = { left = 0, right = 1 } },
|
||||
{ "process", icons_only = true, padding = { left = 0, right = 0 } },
|
||||
},
|
||||
tabline_x = {},
|
||||
tabline_y = {
|
||||
{
|
||||
"datetime",
|
||||
icons_only = false,
|
||||
hour_to_icon = types.hours_icons,
|
||||
padding = { left = 0, right = 1 },
|
||||
style = "%a %R",
|
||||
},
|
||||
},
|
||||
tabline_z = {
|
||||
{ "hostname", padding = { left = 0, right = 1 } },
|
||||
{
|
||||
"battery",
|
||||
battery_to_icon = {
|
||||
empty = {
|
||||
wezterm.nerdfonts.fa_battery_empty .. " ",
|
||||
color = { fg = funcs.invert_color_brightness("#f37ca0") },
|
||||
},
|
||||
quarter = {
|
||||
wezterm.nerdfonts.fa_battery_quarter .. " ",
|
||||
color = { fg = funcs.invert_color_brightness("#ffb080") },
|
||||
},
|
||||
half = {
|
||||
wezterm.nerdfonts.fa_battery_half .. " ",
|
||||
color = { fg = funcs.invert_color_brightness("#fbe2a9") },
|
||||
},
|
||||
three_quarters = wezterm.nerdfonts.fa_battery_three_quarters .. " ",
|
||||
full = {
|
||||
wezterm.nerdfonts.fa_battery_full .. " ",
|
||||
color = { fg = funcs.invert_color_brightness("#93e398") },
|
||||
},
|
||||
},
|
||||
padding = { left = 0, right = 1 },
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = { "resurrect" },
|
||||
})
|
||||
|
||||
local function apply_tabline_config(conf)
|
||||
conf.use_fancy_tab_bar = false
|
||||
conf.show_new_tab_button_in_tab_bar = false
|
||||
conf.tab_max_width = 64
|
||||
conf.window_padding = {
|
||||
left = 0,
|
||||
right = 0,
|
||||
top = 0,
|
||||
bottom = 0,
|
||||
}
|
||||
local normbg = require("tabline.config").colors.normal_mode.c.bg
|
||||
conf.colors = {
|
||||
tab_bar = {
|
||||
background = normbg,
|
||||
inactive_tab_edge = normbg,
|
||||
},
|
||||
}
|
||||
config.status_update_interval = 500
|
||||
end
|
||||
|
||||
apply_tabline_config(config)
|
||||
@@ -1,44 +0,0 @@
|
||||
-- ╭─────────────────────────────────────────────────────────╮
|
||||
-- │ WEZBAR │
|
||||
-- ╰─────────────────────────────────────────────────────────╯
|
||||
|
||||
local M = {}
|
||||
|
||||
-- Load Wezbar plugin
|
||||
WEZBAR = WEZTERM.plugin.require("https://github.com/nekowinston/wezterm-bar")
|
||||
|
||||
-- Configure wezbar
|
||||
WEZBAR.apply_to_config(CONFIG, {
|
||||
position = "top",
|
||||
max_width = 32,
|
||||
dividers = "arrows", -- or "slant_left", "arrows", "rounded", false
|
||||
indicator = {
|
||||
leader = {
|
||||
enabled = true,
|
||||
off = " ",
|
||||
on = " ",
|
||||
},
|
||||
mode = {
|
||||
enabled = true,
|
||||
names = {
|
||||
resize_mode = "RESIZE",
|
||||
copy_mode = "VISUAL",
|
||||
search_mode = "SEARCH",
|
||||
},
|
||||
},
|
||||
},
|
||||
tabs = {
|
||||
numerals = "arabic", -- or "roman"
|
||||
pane_count = "superscript", -- or "subscript", false
|
||||
brackets = {
|
||||
active = { "", ":" },
|
||||
inactive = { "", ":" },
|
||||
},
|
||||
},
|
||||
clock = { -- note that this overrides the whole set_right_status
|
||||
enabled = true,
|
||||
format = "%a %R ", -- use https://wezfurlong.org/wezterm/config/lua/wezterm.time/Time/format.html
|
||||
},
|
||||
})
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user