Yazi makeover
This commit is contained in:
parent
49e4e79ed4
commit
8780604ade
4 changed files with 226 additions and 195 deletions
|
|
@ -40,27 +40,53 @@ function Manager:render(area)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Show user and hostname in top bar
|
-- Show user and hostname in top bar
|
||||||
-- function Header:host()
|
function Header:host()
|
||||||
-- return ui.Span(ya.user_name() .. "@" .. ya.host_name() .. ":"):fg("blue")
|
if ya.target_family() ~= "unix" then
|
||||||
-- end
|
return ui.Line {}
|
||||||
--
|
end
|
||||||
-- function Header:layout(area)
|
return ui.Line { ui.Span(ya.user_name() .. "@" .. ya.host_name()):fg("lightgreen"):bold(true), ui.Span(":") }
|
||||||
-- self.area = area
|
end
|
||||||
--
|
|
||||||
-- return ui.Layout()
|
function Header:render(area)
|
||||||
-- :direction(ui.Layout.HORIZONTAL)
|
self.area = area
|
||||||
-- :constraints({ ui.Constraint.Percentage(50), ui.Constraint.Percentage(50) })
|
|
||||||
-- :split(area)
|
local right = ui.Line { self:count(), self:tabs() }
|
||||||
-- end
|
local left = ui.Line {
|
||||||
--
|
self:host(),
|
||||||
-- function Header:render(area)
|
self:cwd(math.max(0, area.w - right:width())):fg("blue"),
|
||||||
-- local chunks = self:layout(area)
|
ui.Span("/"):fg("blue"):bold(true),
|
||||||
--
|
ui.Span(tostring(cx.active.current.hovered.name)):fg("white"):bold(true),
|
||||||
-- local left = ui.Line { self:host(), self:cwd() }
|
}
|
||||||
-- local right = ui.Line { self:tabs() }
|
return {
|
||||||
-- return {
|
ui.Paragraph(area, { left }),
|
||||||
-- ui.Paragraph(chunks[1], { left }),
|
ui.Paragraph(area, { right }):align(ui.Paragraph.RIGHT),
|
||||||
-- ui.Paragraph(chunks[2], { right }):align(ui.Paragraph.RIGHT),
|
}
|
||||||
-- }
|
end
|
||||||
-- end
|
|
||||||
--
|
-- Show symlink path in status bar
|
||||||
|
function Status:name()
|
||||||
|
local h = cx.active.current.hovered
|
||||||
|
if not h then
|
||||||
|
return ui.Span("")
|
||||||
|
end
|
||||||
|
|
||||||
|
local linked = ""
|
||||||
|
if h.link_to ~= nil then
|
||||||
|
linked = " -> " .. tostring(h.link_to)
|
||||||
|
end
|
||||||
|
return ui.Span(" " .. h.name .. linked)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Remove file size from status bar
|
||||||
|
function Status:render(area)
|
||||||
|
self.area = area
|
||||||
|
|
||||||
|
local left = ui.Line { self:mode(), self:name() }
|
||||||
|
local right = ui.Line { self:permissions(), self:position() }
|
||||||
|
return {
|
||||||
|
ui.Paragraph(area, { left }),
|
||||||
|
ui.Paragraph(area, { right }):align(ui.Paragraph.RIGHT),
|
||||||
|
table.unpack(Progress:render(area, right:width())),
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,12 @@
|
||||||
[manager]
|
[manager]
|
||||||
|
|
||||||
prepend_keymap = [
|
prepend_keymap = [
|
||||||
{ on = [ "l" ], exec = [ "plugin smart-enter --sync", "escape --visual --select" ], desc = "Enter the child directory, or open file." },
|
{ on = [ "j" ], run = [ "plugin --sync arrow --args=1"], desc = "Move selection downwards, or wrap." },
|
||||||
{ on = [ "L" ], exec = "plugin smart-enter --sync --args='detatch'", desc = "Open in new window." },
|
{ on = [ "k" ], run = [ "plugin --sync arrow --args=-1"], desc = "Move selection upwards, or wrap." },
|
||||||
{ on = [ "n" ], exec = "create", desc = "Create a file or directory (ends with / for directories)" },
|
{ on = [ "l" ], run = [ "plugin smart-enter --sync", "escape --visual --select" ], desc = "Enter the child directory, or open file." },
|
||||||
{ on = [ "=" ], exec = """
|
{ on = [ "L" ], run = "plugin smart-enter --sync --args='detatch'", desc = "Open in new window." },
|
||||||
|
{ on = [ "n" ], run = "create", desc = "Create a file or directory (ends with / for directories)" },
|
||||||
|
{ on = [ "=" ], run = """
|
||||||
shell 'printf "Mode Bits: "; read ans; chmod $ans "$@"' --block --confirm
|
shell 'printf "Mode Bits: "; read ans; chmod $ans "$@"' --block --confirm
|
||||||
""", desc = "chmod" },
|
""", desc = "chmod" },
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
cwd = { fg = "white", bold = true }
|
cwd = { fg = "white", bold = true }
|
||||||
|
|
||||||
# Hovered
|
# Hovered
|
||||||
hovered = { fg = "black", bg = "lightblue" }
|
hovered = { reversed = true }
|
||||||
preview_hovered = { underline = true }
|
preview_hovered = { underline = true }
|
||||||
|
|
||||||
# Find
|
# Find
|
||||||
|
|
@ -40,14 +40,14 @@ syntect_theme = ""
|
||||||
# : Status {{{
|
# : Status {{{
|
||||||
|
|
||||||
[status]
|
[status]
|
||||||
separator_open = ""
|
separator_open = ""
|
||||||
separator_close = ""
|
separator_close = ""
|
||||||
separator_style = { fg = "darkgray", bg = "darkgray" }
|
separator_style = { fg = "darkgray", bg = "darkgray" }
|
||||||
|
|
||||||
# Mode
|
# Mode
|
||||||
mode_normal = { fg = "black", bg = "lightblue", bold = true }
|
mode_normal = { fg = "black", bg = "lightblue", bold = false }
|
||||||
mode_select = { fg = "black", bg = "lightgreen", bold = true }
|
mode_select = { fg = "black", bg = "lightgreen", bold = false }
|
||||||
mode_unset = { fg = "black", bg = "lightmagenta", bold = true }
|
mode_unset = { fg = "black", bg = "lightmagenta", bold = false }
|
||||||
|
|
||||||
# Progress
|
# Progress
|
||||||
progress_label = { bold = true }
|
progress_label = { bold = true }
|
||||||
|
|
@ -166,7 +166,9 @@ rules = [
|
||||||
|
|
||||||
# Fallback
|
# Fallback
|
||||||
# { name = "*", fg = "white" },
|
# { name = "*", fg = "white" },
|
||||||
{ name = "*", fg = "yellow", bold = true, is = "exec" },
|
{ name = "*", fg = "cyan", bold = true, is = "link" },
|
||||||
|
{ name = "*", fg = "green", bold = true, is = "exec" },
|
||||||
|
{ name = "*/", fg = "cyan", bold = true, is = "link" },
|
||||||
{ name = "*/", fg = "blue", bold = true }
|
{ name = "*/", fg = "blue", bold = true }
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
@ -390,6 +392,7 @@ rules = [
|
||||||
{ name = "LICENSE" , text = "", fg = "#d0bf41" },
|
{ name = "LICENSE" , text = "", fg = "#d0bf41" },
|
||||||
|
|
||||||
# Default
|
# Default
|
||||||
|
{ name = "*", text = "", is = "exec" },
|
||||||
{ name = "*" , text = "" },
|
{ name = "*" , text = "" },
|
||||||
{ name = "*/", text = "", fg = "yellow" },
|
{ name = "*/", text = "", fg = "yellow" },
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ sort_reverse = false
|
||||||
sort_dir_first = true
|
sort_dir_first = true
|
||||||
linemode = "size"
|
linemode = "size"
|
||||||
show_hidden = true
|
show_hidden = true
|
||||||
show_symlink = true
|
show_symlink = false
|
||||||
|
|
||||||
[preview]
|
[preview]
|
||||||
tab_size = 2
|
tab_size = 2
|
||||||
|
|
@ -25,7 +25,7 @@ ueberzug_offset = [ 0, 0, 0, 0 ]
|
||||||
|
|
||||||
[opener]
|
[opener]
|
||||||
open = [
|
open = [
|
||||||
{ exec = 'opener "$@"', block = true, desc = "Open" },
|
{ run = 'opener "$@"', block = true, desc = "Open" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[open]
|
[open]
|
||||||
|
|
@ -46,42 +46,42 @@ suppress_preload = false
|
||||||
[plugin]
|
[plugin]
|
||||||
|
|
||||||
preloaders = [
|
preloaders = [
|
||||||
{ name = "*", cond = "!mime", exec = "mime", multi = true, prio = "high" },
|
{ name = "*", cond = "!mime", run = "mime", multi = true, prio = "high" },
|
||||||
# Image
|
# Image
|
||||||
{ mime = "image/vnd.djvu", exec = "noop" },
|
{ mime = "image/vnd.djvu", run = "noop" },
|
||||||
{ mime = "image/*", exec = "image" },
|
{ mime = "image/*", run = "image" },
|
||||||
# Video
|
# Video
|
||||||
{ mime = "video/*", exec = "video" },
|
{ mime = "video/*", run = "video" },
|
||||||
# PDF
|
# PDF
|
||||||
{ mime = "application/pdf", exec = "pdf" },
|
{ mime = "application/pdf", run = "pdf" },
|
||||||
]
|
]
|
||||||
previewers = [
|
previewers = [
|
||||||
{ name = "*/", exec = "folder", sync = true },
|
{ name = "*/", run = "folder", sync = true },
|
||||||
# Code
|
# Code
|
||||||
{ mime = "text/*", exec = "code" },
|
{ mime = "text/*", run = "code" },
|
||||||
{ mime = "*/xml", exec = "code" },
|
{ mime = "*/xml", run = "code" },
|
||||||
{ mime = "*/javascript", exec = "code" },
|
{ mime = "*/javascript", run = "code" },
|
||||||
{ mime = "*/x-wine-extension-ini", exec = "code" },
|
{ mime = "*/x-wine-extension-ini", run = "code" },
|
||||||
# JSON
|
# JSON
|
||||||
{ mime = "application/json", exec = "json" },
|
{ mime = "application/json", run = "json" },
|
||||||
# Image
|
# Image
|
||||||
{ mime = "image/vnd.djvu", exec = "noop" },
|
{ mime = "image/vnd.djvu", run = "noop" },
|
||||||
{ mime = "image/*", exec = "image" },
|
{ mime = "image/*", run = "image" },
|
||||||
# Video
|
# Video
|
||||||
{ mime = "video/*", exec = "video" },
|
{ mime = "video/*", run = "video" },
|
||||||
# PDF
|
# PDF
|
||||||
{ mime = "application/pdf", exec = "pdf" },
|
{ mime = "application/pdf", run = "pdf" },
|
||||||
# Archive
|
# Archive
|
||||||
{ mime = "application/zip", exec = "archive" },
|
{ mime = "application/zip", run = "archive" },
|
||||||
{ mime = "application/gzip", exec = "archive" },
|
{ mime = "application/gzip", run = "archive" },
|
||||||
{ mime = "application/x-tar", exec = "archive" },
|
{ mime = "application/x-tar", run = "archive" },
|
||||||
{ mime = "application/x-bzip", exec = "archive" },
|
{ mime = "application/x-bzip", run = "archive" },
|
||||||
{ mime = "application/x-bzip2", exec = "archive" },
|
{ mime = "application/x-bzip2", run = "archive" },
|
||||||
{ mime = "application/x-7z-compressed", exec = "archive" },
|
{ mime = "application/x-7z-compressed", run = "archive" },
|
||||||
{ mime = "application/x-rar", exec = "archive" },
|
{ mime = "application/x-rar", run = "archive" },
|
||||||
{ mime = "application/xz", exec = "archive" },
|
{ mime = "application/xz", run = "archive" },
|
||||||
# Fallback
|
# Fallback
|
||||||
{ name = "*", exec = "file" },
|
{ name = "*", run = "file" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue