summaryrefslogtreecommitdiff
path: root/yazi/init.lua
blob: 7568c874332785d3affd5a85eb4a25b0c26e5dd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
require("full-border"):setup()
require("fs-usage"):setup()

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



require("lin-decompress"):setup({
 -- Global commands for all .tar.* archives (e.g. .tar.lz, .tar.lzo, .tar.gz)
 global_tar_compressor = {
  -- Commands for each .tar.* archive,
  -- Appends these 'cmd's only if 'no_global_tar = false' is set for a .tar.* configuration below
  cmd = { "-dkc" },
 },

 -- NOTE: Use the '[name of mimetype]' portion when defining new extractors'
 --
 -- Schema:
 -- ["application/[<name of mimetype>]"] ={
 --  tool_name = "Name of tool to use for this mimetype",
 --  cmd = { list of arguments to use},
 --  no_global_tar = true (default: false) (Appends the commands specified in the 'global_tar_compressor.cmd')
 --  exts = {extension_name = true, ...} (Extension names of the archive to extract. Used only as a fallback in case mime detection fails)
 -- }
 -- Configurations for compressors commonly used with .tar.*
 tar_compressors = {
  ["lz4"] = {
   tool_name = "lz4",
   exts = {
    lz4 = true,
   },
  },
  ["xz"] = {
   tool_name = "xz",
   cmd = { "-T0" },
   exts = {
    xz = true,
   },
  },
  ["gzip"] = {
   tool_name = "gzip",
   exts = {
    gz = true,
   },
  },
  ["compress"] = {
   tool_name = "uncompress",
   exts = {
    Z = true,
   },
  },
  ["bzip2"] = {
   tool_name = "bzip2",
   exts = {
    bz2 = true,
   },
  },
  ["zstd"] = {
   tool_name = "zstd",
   cmd = { "-T0" },
   exts = {
    zst = true,
   },
  },
  ["lzop"] = {
   tool_name = "lzop",
   exts = {
    lzo = true,
   },
  },
  ["lzip"] = {
   tool_name = "lzip",
   exts = {
    lz = true,
   },
  },
  ["lzma"] = {
   tool_name = "lzma",
   exts = {
    lzma = true,
   },
  },
 },
 -- NOTE: Use the '[name of mimetype]' portion when defining new extractors'
 --
 -- Schema:
 -- ["application/[name of mimetype]"] ={
 --  tool_name = "Name of tool to use",
 --  cmd = {list of arguments to use },
 --  out_cmd = "The command to output extracted content",
 --  pw_cmd = "Command to input a Password"
 --  exts = {extension_name = true, ...} (Extension names of the archive to extract. Used only as a fallback in case mime detection fails)
 -- }
 -- Configurations for non .tar archives
 other_compressors = {
  ["rar"] = {
   tool_name = "unrar",
   cmd = { "x" },
   out_cmd = "-op",
   pw_cmd = "-p",
   exts = {
    rar = true,
   },
  },
  -- The default tool to use to extract ALL types of archive files
  ["default"] = {
   tool_name = "7z",
   cmd = { "x", "-mmt=0" },
   out_cmd = "-o",
   pw_cmd = "-p",
  },
 },
})