59 lines
1.8 KiB
Lua
59 lines
1.8 KiB
Lua
-- full border
|
|
require("full-border"):setup()
|
|
-- size and time linemode
|
|
function Linemode:size_and_mtime()
|
|
local time = math.floor(self._file.cha.mtime or 0)
|
|
if time == 0 then
|
|
time = ""
|
|
elseif os.date("%Y", time) == os.date("%Y") then
|
|
time = os.date("%b %d %H:%M", time)
|
|
else
|
|
time = os.date("%b %d %Y", time)
|
|
end
|
|
|
|
local size = self._file:size()
|
|
return string.format("%s %s", size and ya.readable_size(size) or "-", time)
|
|
end
|
|
|
|
-- show symlinks
|
|
Status:children_add(function(self)
|
|
local h = self._current.hovered
|
|
if h and h.link_to then
|
|
return " -> " .. tostring(h.link_to)
|
|
else
|
|
return ""
|
|
end
|
|
end, 3300, Status.LEFT)
|
|
-- Show user/group of files in status bar
|
|
Status:children_add(function()
|
|
local h = cx.active.current.hovered
|
|
if h == nil or ya.target_family() ~= "unix" then
|
|
return ""
|
|
end
|
|
|
|
return ui.Line {
|
|
ui.Span(ya.user_name(h.cha.uid) or tostring(h.cha.uid)):fg("magenta"),
|
|
":",
|
|
ui.Span(ya.group_name(h.cha.gid) or tostring(h.cha.gid)):fg("magenta"),
|
|
" ",
|
|
}
|
|
end, 500, Status.RIGHT)
|
|
-- Show username and hostname in header
|
|
Header:children_add(function()
|
|
if ya.target_family() ~= "unix" then
|
|
return ""
|
|
end
|
|
return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue")
|
|
end, 500, Header.LEFT)
|
|
-- startship prompt
|
|
require("starship"):setup({
|
|
-- Hide flags (such as filter, find and search). This is recommended for starship themes which
|
|
-- are intended to go across the entire width of the terminal.
|
|
hide_flags = false, -- Default: false
|
|
-- Whether to place flags after the starship prompt. False means the flags will be placed before the prompt.
|
|
flags_after_prompt = true, -- Default: true
|
|
-- Custom starship configuration file to use
|
|
config_file = "~/.config/starship_full.toml", -- Default: nil
|
|
})
|
|
-- git for yazi
|
|
require("git"):setup()
|