Last active
June 5, 2025 15:20
-
-
Save mebiusbox/515c4b464db55a2109c46908030b9cf2 to your computer and use it in GitHub Desktop.
yazi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local function split_path(path) | |
-- https://stackoverflow.com/a/5243557 | |
return string.match(path, "(.-)([^\\]-([^%.]+))$") | |
end | |
local function wrap(text, with) | |
if text == "" then | |
return text | |
else | |
return with .. text .. with | |
end | |
end | |
Status:children_add(function() | |
local h = cx.active.current.hovered | |
if h == nil then | |
return "" | |
end | |
local root, name, ext = split_path(h.name) | |
ext = "." .. ext | |
if name == ext then | |
ext = "" | |
end | |
return ui.Line { | |
ui.Span(wrap(ext, " ")):fg("#242424"):bg("#dddddd") | |
} | |
end, 600, Status.RIGHT) | |
Status:children_add(function() | |
return ui.Span(" ") | |
end, 610, Status.RIGHT) | |
Status:children_add(function() | |
local h = cx.active.current.hovered | |
if h == nil then | |
return "" | |
end | |
local time = math.floor(h.cha.mtime or 0) | |
if time == 0 then | |
time = "" | |
elseif os.date("%Y",time) == os.date("%Y") then | |
time = os.date(" %H:%M", time) | |
else | |
time = os.date("%Y-%m-%d", time) | |
end | |
return ui.Line { | |
ui.Span(time):fg("magenta") | |
} | |
end, 700, Status.RIGHT) | |
Status:children_add(function() | |
local h = cx.active.current.hovered | |
if not h or not h.cha.uid or not h.cha.gid then | |
return ui.Span("") | |
end | |
local user = ya.user_name(h.cha.uid) or h.cha.uid | |
local group = ya.group_name(h.cha.gid) or h.cha.gid | |
return ui.Line(string.format("%s:%s ", user, group)) | |
end, 800, Status.RIGHT) | |
function Linemode:msize_YYMMdd() | |
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 | |
end | |
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) | |
time = os.date(" %H:%M", time) | |
else | |
-- time = os.date("%b %d %Y", time) | |
time = os.date("%Y-%m-%d", time) | |
end | |
local size = self._file:size() | |
return string.format("%s %s", size and ya.readable_size(size) or "", time) | |
end | |
function Linemode:size_file_only() | |
local size = self._file:size() | |
return string.format("%s", size and ya.readable_size(size) or "") | |
end | |
function Entity:icon() | |
local icon = self._file:icon() | |
if not icon then | |
return "" | |
elseif self._file.is_hovered then | |
return icon.text .. " " | |
else | |
return ui.Line(icon.text .. " "):style(icon.style) | |
end | |
end | |
require("full-border"):setup() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A TOML linter such as https://taplo.tamasfe.dev/ can use this schema to validate your config. | |
# If you encounter any issues, please make an issue at https://github.com/yazi-rs/schemas. | |
"$schema" = "https://yazi-rs.github.io/schemas/keymap.json" | |
# Linemode | |
[[mgr.append_keymap]] | |
on = "M" | |
run = "linemode size_file_only" | |
desc = "Linemode: size" | |
# [[manager.append_keymap]] | |
# on = [ "c", "a" ] | |
# run = "plugin compress" | |
# desc = "Archive selected files" | |
# Shell | |
[[mgr.prepend_keymap]] | |
on = "!" | |
run = 'shell "pwsh.exe" --block' | |
desc = "Open PowerShell here" | |
# toggle-pane | |
[[mgr.prepend_keymap]] | |
on = "p" | |
run = "plugin toggle-pane min-preview" | |
desc = "Show or hide the preview pane" | |
[[mgr.prepend_keymap]] | |
on = "i" | |
run = "plugin toggle-pane max-preview" | |
desc = "Maximize or restore the preview pane" | |
[[mgr.append_keymap]] | |
on = [ "c", "a" ] | |
run = "plugin pixy-archive compress" | |
desc = "Archive selected files" | |
[[mgr.append_keymap]] | |
on = [ "c", "e" ] | |
run = "plugin pixy-archive extract" | |
desc = "Extract selected archive" | |
# plugin: bookmarks | |
[[mgr.prepend_keymap]] | |
on = [ "b", "k" ] | |
run = "plugin bookmarks save" | |
desc = "Save current position as a bookmark" | |
[[mgr.prepend_keymap]] | |
on = [ "b", "j" ] | |
run = "plugin bookmarks jump" | |
desc = "Jump to a bookmark" | |
[[mgr.prepend_keymap]] | |
on = [ "b", "d" ] | |
run = "plugin bookmarks delete" | |
desc = "Delete a bookmark" | |
[[mgr.prepend_keymap]] | |
on = [ "b", "D" ] | |
run = "plugin bookmarks delete_all" | |
desc = "Delete all bookmarks" | |
[[mgr.prepend_keymap]] | |
on = [ "c", "o" ] | |
run = "shell 'C:\\PROGRA~2\\FREECO~1\\FREECO~1.EXE /T %*' --block --orphan" | |
desc = "Reveal (FreeCommander)" | |
[[mgr.prepend_keymap]] | |
on = [ "c", "v" ] | |
run = "shell 'fx %1' --block" | |
desc = "fx (json,yaml)" | |
[[mgr.prepend_keymap]] | |
on = [ "c", "t" ] | |
run = "shell 'type %1 | jyt tj | fx' --block" | |
desc = "fx (toml)" | |
[[mgr.prepend_keymap]] | |
on = [ "c", "u" ] | |
run = "plugin pixy-powershell copy-url" | |
desc = "Copy url" | |
[[mgr.prepend_keymap]] | |
on = [ "g", "t" ] | |
run = "cd ~/Desktop" | |
desc = "Go to desktop" | |
[[mgr.prepend_keymap]] | |
on = [ "g", "m" ] | |
run = "cd ~/Documents" | |
desc = "Go to documents" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#E373CE | |
#FFD945 | |
#FF9700 | |
#81F900 | |
#FF3F4F | |
#19D1E5 | |
#528bff | |
#1f1f28 | |
#5c6773 | |
#dddddd | |
#b6036b | |
[mgr] | |
cwd = { fg = "yellow" } | |
hovered = { reversed = true } | |
preview_hovered = { reversed = true } | |
tab_active = { reversed = true } | |
tab_inactive = {} | |
tab_width = 1 | |
# default bg | |
count_copied = { fg = "#1f1f28", bg = "#81F900" } | |
count_cut = { fg = "#1f1f28", bg = "#FF3F4F" } | |
count_selected = { fg = "#1f1f28", bg = "#FFD945" } | |
# Find | |
find_keyword = { bg = "white", fg = "#FF3F4F", bold = true, italic = false, underline = false } | |
# marker | |
# marker_copied = { fg = "#0a0e14", bg = "#7e9350" } | |
# marker_cut = { fg = "#0a0e14", bg = "#a85361" } | |
# marker_marked = { fg = "#0a0e14", bg = "#1f6f88" } | |
marker_selected = { fg = "#b6036b", bg = "#b6036b" } | |
# Border | |
# border_symbol = " " | |
border_symbol = "│" | |
border_style = { fg = "#5c6773" } | |
[which] | |
cols = 2 | |
separator = " | " | |
separator_style = { fg = "#292B30" } | |
mask = { bg = "#16161d" } # dark bg | |
rest = { fg = "#727169" } # darkgrey | |
cand = { fg = "white" } | |
desc = { fg = "yellow" } | |
[mode] | |
normal_main = { fg = "#0a0e14", bg = "#c2a05c", bold = true } | |
normal_alt = { fg = "#dddddd", bg = "#2d3640", bold = true } | |
select_main = { fg = "#0a0e14", bg = "#1f6f88", bold = true } | |
select_alt = { fg = "#0a0e14", bg = "#1f6f88", bold = true } | |
unset_main = { fg = "#0a0e14", bg = "#a85361", bold = true } | |
unset_alt = { fg = "#0a0e14", bg = "#a85361", bold = true } | |
[status] | |
separator_open = "" | |
separator_close = "" | |
separator_style = { fg = "reset", bg = "#363646" } | |
# default bg | |
mode_normal = { fg = "#1f1f28", bg = "white", bold = true } | |
mode_select = { fg = "#1f1f28", bg = "#FF3F4F", bold = true } | |
mode_unset = { fg = "#1f1f28", bg = "#FFD945", bold = true } | |
progress_label = { fg = "#19D1E5", bg = "#363646", bold = true } | |
progress_normal = { fg = "#363646", bg = "#1f1f28" } | |
progress_error = { fg = "#363646", bg = "#1f1f28" } | |
[input] | |
border = { fg = "#7fb4ca" } # blue | |
title = {} | |
value = { } | |
selected = { reversed = true } | |
[completion] | |
border = { fg = "#7fb4ca" } # blue | |
active = { reversed = true } | |
inactive = {} | |
[pick] | |
[tasks] | |
border = { fg = "#7fb4ca" } # blue | |
title = { } | |
hovered = { fg = "#938aa9" } | |
[help] | |
on = { fg = "#7aa89f" } # cyan | |
run = { fg = "#938aa9" } | |
desc = { } | |
hovered = { reversed = true, bold = true } | |
footer = { fg = "#090618", bg = "#dcd7ba" } # white | |
# files | |
[filetype] | |
rules = [ | |
# media | |
{ mime = "image/*", fg = "#FFD945" }, | |
{ mime = "{audio,video}/*", fg = "#81F900" }, | |
# archives | |
{ mime = "application/{,g}zip", fg = "#FF3F4F" }, | |
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "#FF3F4F" }, | |
# documents | |
{ mime = "application/{pdf,doc,rtf,vnd.*}", fg = "#0D96DE" }, | |
# scripts and code | |
{ mime = "application/{x-shellscript,x-python,x-ruby,x-javascript}", fg = "#c2a05c" }, | |
# config files | |
# { name = "*.json", fg = "#c2a05c" }, | |
# { name = "*.yml", fg = "#1f6f88" }, | |
# { name = "*.yaml", fg = "#1f6f88" }, | |
# { name = "*.toml", fg = "#9464b6" }, | |
{ name = "*.{json,yml,yaml,toml}", fg = "#c2a05c" }, | |
{ name = "*", is = "orphan", fg = "#FF3F4F" }, | |
{ name = "*", is = "exec", fg = "#81F900" }, | |
{ name = "*", fg = "#dddddd"}, | |
{ name = "*/", fg = "green"} | |
] | |
[icon] | |
prepend_exts = [ | |
# multimedia | |
{ name = "avi", text = "\uf1c8" }, | |
{ name = "mpg", text = "\uf1c8" }, | |
{ name = "mpeg", text = "\uf1c8" }, | |
{ name = "mkv", text = "\uf1c8" }, | |
{ name = "mp4", text = "\uf1c8" }, | |
{ name = "mp3", text = "\uf1c7" }, | |
{ name = "wav", text = "\uf1c7" }, | |
{ name = "ogg", text = "\uf1c7" }, | |
{ name = "pdf", text = "\uf1c1" }, | |
# code | |
{ name = "c", text = "\uf1c9" }, | |
{ name = "cpp", text = "\uf1c9" }, | |
{ name = "cxx", text = "\uf1c9" }, | |
{ name = "h", text = "\uf1c9" }, | |
{ name = "hpp", text = "\uf1c9" }, | |
{ name = "hxx", text = "\uf1c9" }, | |
{ name = "cs", text = "\uf1c9" }, | |
{ name = "tex", text = "\uf1c9" }, | |
{ name = "rs", text = "\uf1c9" }, | |
{ name = "js", text = "\uf1c9" }, | |
{ name = "py", text = "\uf1c9" }, | |
{ name = "lua", text = "\uf1c9" }, | |
{ name = "ps1", text = "\uf1c9" }, | |
# plane text | |
{ name = "txt", text = "\uf15c" }, | |
{ name = "log", text = "\uf15c" }, | |
# executable | |
{ name = "exe", text = "\uf489" }, | |
# temporary | |
{ name = "tmp", text = "\uf0c7" }, | |
{ name = "temp", text = "\uf0c7" }, | |
{ name = "bak", text = "\uf0c7" } | |
] | |
prepend_conds = [ | |
# { if = "dir", text = "📁" } | |
{ if = "!(dir | link)", text = "\uf15b" }, | |
{ if = "dir", text = "\uf07b" } | |
# { if = "dir", text = "\uf114" } | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mgr] | |
# ratio = [ 1, 3, 4 ] | |
# ratio = [ 1, 4, 3 ] | |
ratio = [ 0, 1, 1 ] | |
linemode = "none" | |
# linemode = "size" | |
# linemode = "size_file_only" | |
# linemode = "permissions" | |
# linemode = "mtime" | |
# linemode = "size_and_mtime" | |
[opener] | |
mpv = [ | |
{ run = '%USERPROFILE%\bin\apps\mpv\mpv.exe %*', orphan = true, for = "windows", desc="mpv" } | |
] | |
zipview = [ | |
{ run = 'C:\PROGRA~1\7-Zip\7zFM.exe %*', orphan = true, for = "windows", desc="view (7z)" } | |
] | |
neeview = [ | |
{ run = '%USERPROFILE%\bin\apps\NeeView42.6\NeeView.exe %*', orphan = true, for = "windows", desc="NeeView" } | |
] | |
[open] | |
prepend_rules = [ | |
{ mime = "text/*", use = ["edit", "open"] }, | |
{ mime = "image/*", use = ["open"] }, | |
{ mime = "{audio,video}/*", use = ["mpv"] }, | |
{ mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", use = [ "neeview", "zipview" ] }, | |
{ mime = "application/{json,toml,yaml,yml,xml}", use = ["edit"] }, | |
{ mime = "application/{pdf}", use = ["open"] }, | |
{ name = "*.zip", use = ["neeview", "zipview"] }, | |
{ name = "*.url", use = ["reveal"] }, | |
# Fallback | |
# { name = "*", use = [ "reveal" ] }, | |
] | |
[plugin] | |
prepend_previewers = [ | |
{ name = "*.csv", run = "pixy-bat" }, | |
{ name = "*.md", run = "pixy-bat" }, | |
{ name = "*.json", run = "pixy-gron" }, | |
{ mime = "text/*", run = "pixy-bat" }, | |
{ mime = "application/octet-stream", run = "hexyl -n 64" }, | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment