mirror of
https://github.com/sxyazi/yazi.git
synced 2024-11-27 05:55:43 +03:00
Compare commits
5 Commits
7be32c8925
...
2f65ec961b
Author | SHA1 | Date | |
---|---|---|---|
|
2f65ec961b | ||
|
ce8013c97e | ||
|
b1104860bf | ||
|
22e7d579d2 | ||
|
202751b46a |
@ -1,4 +1,4 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
# Code of Conduct
|
||||
|
||||
## Goal
|
||||
|
||||
@ -21,7 +21,7 @@ Our standards are as follows:
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
- Trolling, insulting or derogatory comments, and personal attacks
|
||||
- Harasing or bullying another person
|
||||
- Harassing or bullying another person
|
||||
- Publishing others' private information without their explicit permission
|
||||
- Posting things unrelated to the topic being discussed
|
||||
- Other conduct that could reasonably be considered inappropriate in a professional setting
|
@ -190,14 +190,15 @@ rules = [
|
||||
{ mime = "{audio,video}/*", fg = "magenta" },
|
||||
|
||||
# Archives
|
||||
{ mime = "application/{,g}zip", fg = "red" },
|
||||
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", fg = "red" },
|
||||
{ mime = "application/{zip,rar,tar,gzip,xz,zstd,bzip*,zlib,lzma,compress,compressed,archive,cpio,arj,deflate,xar}", fg = "red" },
|
||||
{ mime = "application/{zip,rar,7z,gzip,arj}-compressed", fg = "red" },
|
||||
{ mime = "application/vnd.ms-cab-compressed", fg = "red" },
|
||||
|
||||
# Documents
|
||||
{ mime = "application/{pdf,doc,rtf,vnd.*}", fg = "cyan" },
|
||||
|
||||
# Empty files
|
||||
# { mime = "inode/x-empty", fg = "red" },
|
||||
# { mime = "inode/empty", fg = "red" },
|
||||
|
||||
# Special files
|
||||
{ name = "*", is = "orphan", bg = "red" },
|
||||
|
@ -67,13 +67,18 @@ rules = [
|
||||
# Media
|
||||
{ mime = "{audio,video}/*", use = [ "play", "reveal" ] },
|
||||
# Archive
|
||||
{ mime = "application/{,g}zip", use = [ "extract", "reveal" ] },
|
||||
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar}", use = [ "extract", "reveal" ] },
|
||||
{ mime = "application/{zip,rar,tar,gzip,xz,zstd,bzip*,zlib,lzma,compress,compressed,archive,cpio,arj,deflate,xar}", use = [ "extract", "reveal" ] },
|
||||
{ mime = "application/{zip,rar,7z,gzip,arj}-compressed", use = [ "extract", "reveal" ] },
|
||||
{ mime = "application/{debian-package,redhat-package-manager,rpm}", use = [ "extract", "reveal" ] },
|
||||
{ mime = "application/vnd.debian.binary-package", use = [ "extract", "reveal" ] },
|
||||
{ mime = "application/vnd.android.package-archive", use = [ "extract", "reveal" ] },
|
||||
{ mime = "application/vnd.ms-cab-compressed", use = [ "extract", "reveal" ] },
|
||||
{ name = "*.{AppImage,appimage}", use = [ "extract", "reveal" ] },
|
||||
# JSON
|
||||
{ mime = "application/{json,x-ndjson}", use = [ "edit", "reveal" ] },
|
||||
{ mime = "application/{json,ndjson}", use = [ "edit", "reveal" ] },
|
||||
{ mime = "*/javascript", use = [ "edit", "reveal" ] },
|
||||
# Empty file
|
||||
{ mime = "inode/x-empty", use = [ "edit", "reveal" ] },
|
||||
{ mime = "inode/empty", use = [ "edit", "reveal" ] },
|
||||
# Fallback
|
||||
{ name = "*", use = [ "open", "reveal" ] },
|
||||
]
|
||||
@ -96,7 +101,7 @@ spotters = [
|
||||
{ name = "*/", run = "folder" },
|
||||
# Code
|
||||
{ mime = "text/*", run = "code" },
|
||||
{ mime = "*/{xml,javascript,x-wine-extension-ini}", run = "code" },
|
||||
{ mime = "*/{xml,javascript,wine-extension-ini}", run = "code" },
|
||||
# Image
|
||||
{ mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" },
|
||||
{ mime = "image/*", run = "image" },
|
||||
@ -121,9 +126,9 @@ previewers = [
|
||||
{ name = "*/", run = "folder", sync = true },
|
||||
# Code
|
||||
{ mime = "text/*", run = "code" },
|
||||
{ mime = "*/{xml,javascript,x-wine-extension-ini}", run = "code" },
|
||||
{ mime = "*/{xml,javascript,wine-extension-ini}", run = "code" },
|
||||
# JSON
|
||||
{ mime = "application/{json,x-ndjson}", run = "json" },
|
||||
{ mime = "application/{json,ndjson}", run = "json" },
|
||||
# Image
|
||||
{ mime = "image/{avif,hei?,jxl,svg+xml}", run = "magick" },
|
||||
{ mime = "image/*", run = "image" },
|
||||
@ -132,13 +137,25 @@ previewers = [
|
||||
# PDF
|
||||
{ mime = "application/pdf", run = "pdf" },
|
||||
# Archive
|
||||
{ mime = "application/{,g}zip", run = "archive" },
|
||||
{ mime = "application/x-{tar,bzip*,7z-compressed,xz,rar,iso9660-image}", run = "archive" },
|
||||
{ mime = "application/{zip,rar,tar,gzip,xz,zstd,bzip*,zlib,lzma,compress,compressed,archive,cpio,arj,deflate,xar}", run = "archive" },
|
||||
{ mime = "application/{zip,rar,7z,gzip,arj}-compressed", run = "archive" },
|
||||
{ mime = "application/{debian-package,redhat-package-manager,rpm}", run = "archive" },
|
||||
{ mime = "application/vnd.debian.binary-package", run = "archive" },
|
||||
{ mime = "application/vnd.android.package-archive", run = "archive" },
|
||||
{ mime = "application/vnd.ms-cab-compressed", run = "archive" },
|
||||
{ name = "*.{AppImage,appimage}", run = "archive" },
|
||||
# Virtual Disk / Disk Image
|
||||
{ mime = "application/iso9660-image", run = "archive" },
|
||||
{ mime = "application/{qemu,vhd,vhdx,vdi,vmdk}-disk", run = "archive" },
|
||||
{ mime = "application/{vhd,vmdk}", run = "archive" },
|
||||
{ mime = "application/virtualbox-{vdi,vhd,vhdx,vmdk}", run = "archive" },
|
||||
{ mime = "application/{ms-wim,apple-diskimage}", run = "archive" },
|
||||
{ name = "*.{fat,ext,ext2,ext3,ext4,squashfs,ntfs,hfs,hfsx,img}", run = "archive" },
|
||||
# Font
|
||||
{ mime = "font/*", run = "font" },
|
||||
{ mime = "application/vnd.ms-opentype", run = "font" },
|
||||
# Empty file
|
||||
{ mime = "inode/x-empty", run = "empty" },
|
||||
{ mime = "inode/empty", run = "empty" },
|
||||
# Fallback
|
||||
{ name = "*", run = "file" },
|
||||
]
|
||||
|
@ -126,7 +126,7 @@ function Status:position()
|
||||
local style = self:style()
|
||||
return ui.Line {
|
||||
ui.Span(THEME.status.separator_open):fg(style.bg):bg(THEME.status.separator_style.fg),
|
||||
ui.Span(string.format(" %2d/%-2d ", cursor + 1, length)):style(style),
|
||||
ui.Span(string.format(" %2d/%-2d ", math.min(cursor + 1, length), length)):style(style),
|
||||
ui.Span(THEME.status.separator_close):fg(style.bg),
|
||||
}
|
||||
end
|
||||
|
@ -26,6 +26,6 @@ function M:seek(units)
|
||||
})
|
||||
end
|
||||
|
||||
function M:spot(args) require("file"):spot(args) end
|
||||
function M:spot(job) require("file"):spot(job) end
|
||||
|
||||
return M
|
||||
|
@ -28,13 +28,13 @@ local hovered_mime = ya.sync(function()
|
||||
end
|
||||
end)
|
||||
|
||||
function M:spot(args)
|
||||
function M:spot(job)
|
||||
local mime = hovered_mime()
|
||||
if not mime then
|
||||
return
|
||||
end
|
||||
|
||||
local file = args.file
|
||||
local file = job.file
|
||||
local spotter = PLUGIN.spotter(file.url, mime)
|
||||
local previewer = PLUGIN.previewer(file.url, mime)
|
||||
local fetchers = PLUGIN.fetchers(file.url, mime)
|
||||
@ -64,7 +64,7 @@ function M:spot(args)
|
||||
row(" Preloaders:", #preloaders ~= 0 and preloaders or "-")
|
||||
|
||||
ya.spot_table(
|
||||
args,
|
||||
job,
|
||||
ui.Table(rows)
|
||||
:area(ui.Pos { "center", w = 60, h = 20 })
|
||||
:row(1)
|
||||
|
@ -40,6 +40,6 @@ function M:seek(units)
|
||||
end
|
||||
end
|
||||
|
||||
function M:spot(args) require("file"):spot(args) end
|
||||
function M:spot(job) require("file"):spot(job) end
|
||||
|
||||
return M
|
||||
|
@ -22,8 +22,8 @@ function M:preload()
|
||||
return ya.image_precache(self.file.url, cache) and 1 or 2
|
||||
end
|
||||
|
||||
function M:spot(args)
|
||||
local info = ya.image_info(args.file.url)
|
||||
function M:spot(job)
|
||||
local info = ya.image_info(job.file.url)
|
||||
|
||||
local rows = {}
|
||||
local row = function(key, value)
|
||||
@ -37,10 +37,10 @@ function M:spot(args)
|
||||
row("Color:", tostring(info.color))
|
||||
|
||||
ya.spot_table(
|
||||
args,
|
||||
job,
|
||||
ui.Table(rows)
|
||||
:area(ui.Pos { "center", w = 60, h = 20 })
|
||||
:row(args.skip)
|
||||
:row(job.skip)
|
||||
:col(1)
|
||||
:col_style(ui.Style():fg("blue"))
|
||||
:cell_style(ui.Style():fg("yellow"):reverse())
|
||||
|
@ -41,6 +41,6 @@ function M:preload()
|
||||
return status and status.success and 1 or 2
|
||||
end
|
||||
|
||||
function M:spot(args) require("file"):spot(args) end
|
||||
function M:spot(job) require("file"):spot(job) end
|
||||
|
||||
return M
|
||||
|
@ -3,15 +3,15 @@ local SUPPORTED_TYPES = "application/audio/biosig/chemical/font/image/inode/mess
|
||||
local M = {}
|
||||
|
||||
local function match_mimetype(s)
|
||||
local type, sub = s:match("([-a-z]+/)([+-.a-zA-Z0-9]+)%s*$")
|
||||
if type and sub and SUPPORTED_TYPES:find(type, 1, true) then
|
||||
return type .. sub
|
||||
local type, sub = s:match("^([-a-z]+/)([+-.a-zA-Z0-9]+)%s*$")
|
||||
if type and sub and SUPPORTED_TYPES:find(type, 1, true) then
|
||||
return type:gsub("^x%-", "", 1) .. sub:gsub("^x%-", "", 1)
|
||||
end
|
||||
end
|
||||
|
||||
function M:fetch(args)
|
||||
function M:fetch(job)
|
||||
local urls = {}
|
||||
for _, file in ipairs(args.files) do
|
||||
for _, file in ipairs(job.files) do
|
||||
urls[#urls + 1] = tostring(file.url)
|
||||
end
|
||||
|
||||
@ -44,9 +44,7 @@ function M:fetch(args)
|
||||
end
|
||||
|
||||
valid = match_mimetype(line)
|
||||
if valid and line:find(valid, 1, true) ~= 1 then
|
||||
goto continue
|
||||
elseif valid then
|
||||
if valid then
|
||||
j, updates[urls[i]] = j + 1, valid
|
||||
flush(false)
|
||||
end
|
||||
|
@ -62,6 +62,6 @@ function M:preload()
|
||||
return status and status.success and 1 or 2
|
||||
end
|
||||
|
||||
function M:spot(args) require("file"):spot(args) end
|
||||
function M:spot(job) require("file"):spot(job) end
|
||||
|
||||
return M
|
||||
|
Loading…
Reference in New Issue
Block a user