First commit
This commit is contained in:
commit
847c9e64c0
51 changed files with 4058 additions and 0 deletions
54
.config/wezterm/events/format_tab_title.lua
Normal file
54
.config/wezterm/events/format_tab_title.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
local wezterm = require("wezterm")
|
||||
local util = require("util")
|
||||
|
||||
local scheme = util.get_schemes()["Everforest Dark Soft (Gogh)"]
|
||||
|
||||
local function tab_title(tab_info)
|
||||
local title = tab_info.tab_title
|
||||
-- if the tab title is explicitly set, take that
|
||||
if title and #title > 0 then
|
||||
return title
|
||||
end
|
||||
-- Otherwise, use the title from the active pane
|
||||
-- in that tab
|
||||
return tab_info.active_pane.title
|
||||
end
|
||||
|
||||
wezterm.on(
|
||||
"format-tab-title",
|
||||
function(tab, _, _, _, hover, max_width)
|
||||
local LEFT_CIRCLE = ""
|
||||
local RIGHT_CIRCLE = ""
|
||||
|
||||
local edge_background = scheme.background
|
||||
local background = scheme.brights[1]
|
||||
local foreground = scheme.brights[8]
|
||||
|
||||
-- ensure that the titles fit in the available space,
|
||||
-- and that we have room for the edges.
|
||||
local title = tab_title(tab)
|
||||
title = wezterm.truncate_right(title, max_width - 2)
|
||||
|
||||
if tab.is_active then
|
||||
background = scheme.ansi[8]
|
||||
foreground = scheme.ansi[1]
|
||||
elseif hover then
|
||||
background = scheme.brights[1]
|
||||
foreground = scheme.brights[8]
|
||||
end
|
||||
|
||||
local edge_foreground = background
|
||||
|
||||
return {
|
||||
{ Background = { Color = edge_background } },
|
||||
{ Foreground = { Color = edge_foreground } },
|
||||
{ Text = LEFT_CIRCLE },
|
||||
{ Background = { Color = background } },
|
||||
{ Foreground = { Color = foreground } },
|
||||
{ Text = title },
|
||||
{ Background = { Color = edge_background } },
|
||||
{ Foreground = { Color = edge_foreground } },
|
||||
{ Text = RIGHT_CIRCLE },
|
||||
}
|
||||
end
|
||||
)
|
56
.config/wezterm/events/update_status.lua
Normal file
56
.config/wezterm/events/update_status.lua
Normal file
|
@ -0,0 +1,56 @@
|
|||
local wezterm = require("wezterm")
|
||||
local util = require("util")
|
||||
|
||||
local scheme = util.get_schemes()["Everforest Dark Soft (Gogh)"]
|
||||
|
||||
wezterm.on("update-status", function(window, pane)
|
||||
local right_status = {}
|
||||
|
||||
-- modes
|
||||
local modes = {
|
||||
copy_mode = { text = " COPY ", bg = scheme.brights[3] },
|
||||
search_mode = { text = " SEARCH ", bg = scheme.brights[4] }
|
||||
}
|
||||
local name = window:active_key_table()
|
||||
local mode_fmt = {}
|
||||
if name and modes[name] then
|
||||
mode_fmt = modes[name]
|
||||
table.insert(right_status, { Background = { Color = mode_fmt["bg"] } })
|
||||
table.insert(right_status, { Foreground = { Color = scheme.ansi[1] } })
|
||||
table.insert(right_status, { Attribute = { Intensity = "Bold" } })
|
||||
table.insert(right_status, { Attribute = { Italic = true } })
|
||||
table.insert(right_status, { Text = mode_fmt["text"] })
|
||||
end
|
||||
|
||||
-- cwd
|
||||
local cwd = pane:get_current_working_dir()
|
||||
local cwd_path = ""
|
||||
if cwd then
|
||||
cwd_path = cwd.file_path
|
||||
end
|
||||
|
||||
local home_dir = os.getenv("HOME")
|
||||
|
||||
local config_dir = os.getenv("XDG_CONFIG_HOME") or home_dir .. "/.config"
|
||||
if cwd_path:find(config_dir, 1, true) == 1 then
|
||||
cwd_path = string.gsub(cwd_path, config_dir, " ")
|
||||
end
|
||||
|
||||
local dev_dir = home_dir .. "/workspace"
|
||||
if cwd_path:find(dev_dir, 1, true) == 1 then
|
||||
cwd_path = string.gsub(cwd_path, dev_dir, " ")
|
||||
end
|
||||
|
||||
if home_dir and cwd_path:find(home_dir, 1, true) == 1 then
|
||||
cwd_path = string.gsub(cwd_path, home_dir, " ")
|
||||
end
|
||||
|
||||
table.insert(right_status, "ResetAttributes")
|
||||
table.insert(right_status, { Background = { Color = scheme.ansi[8] } })
|
||||
table.insert(right_status, { Foreground = { Color = scheme.ansi[1] } })
|
||||
table.insert(right_status, { Attribute = { Intensity = "Bold" } })
|
||||
table.insert(right_status, { Text = cwd_path })
|
||||
|
||||
|
||||
window:set_right_status(wezterm.format(right_status))
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue