130 lines
3.3 KiB
Lua
130 lines
3.3 KiB
Lua
-- size_and_mtime
|
|
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
|
|
-- 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)
|
|
--git
|
|
require("git"):setup()
|
|
-- yatline dracula_theme
|
|
local dracula_theme = require("yatline-dracula"):setup()
|
|
-- yatline
|
|
require("yatline"):setup({
|
|
theme = dracula_theme,
|
|
section_separator = { open = "", close = "" },
|
|
part_separator = { open = "", close = "" },
|
|
inverse_separator = { open = "", close = "" },
|
|
show_background = false,
|
|
tab_width = 0,
|
|
|
|
header_line = {
|
|
left = {
|
|
section_a = {
|
|
{type = "line", custom = false, name = "tabs", params = {"left"}},
|
|
},
|
|
section_b = {
|
|
},
|
|
section_c = {
|
|
}
|
|
},
|
|
right = {
|
|
section_a = {
|
|
{type = "string", custom = false, name = "cursor_position"},
|
|
},
|
|
section_b = {
|
|
{type = "string", custom = false, name = "cursor_percentage"},
|
|
},
|
|
section_c = {
|
|
{type = "string", custom = false, name = "hovered_ownership"},
|
|
{type = "coloreds", custom = false, name = "permissions"},
|
|
{type = "coloreds", custom = false, name = "count"},
|
|
}
|
|
}
|
|
},
|
|
|
|
status_line = {
|
|
left = {
|
|
section_a = {
|
|
{type = "string", custom = false, name = "tab_mode"},
|
|
},
|
|
section_b = {
|
|
{type = "string", custom = false, name = "hovered_size"},
|
|
|
|
},
|
|
section_c = {
|
|
{type = "string", custom = false, name = "hovered_path", params = {{ trimed = false, max_length=12, trim_length=5 }},
|
|
},
|
|
{type = "coloreds", custom = false, name = "githead"},
|
|
}
|
|
},
|
|
right = {
|
|
section_a = {
|
|
},
|
|
section_b = {
|
|
},
|
|
section_c = {
|
|
|
|
|
|
}
|
|
}
|
|
},
|
|
})
|
|
-- yatline-tab-path
|
|
-- yatline-githead
|
|
require("yatline-githead"):setup()
|
|
|