1
0
Fork 0

various changes I don't remember lol

This commit is contained in:
Peter Domínguez 2025-10-30 08:28:48 -04:00
parent 07a879aad3
commit 06508d53ac
19 changed files with 90 additions and 90 deletions

View file

@ -21,7 +21,7 @@ run = "plugin chmod"
desc = "Chmod on selected files"
```
Make sure the <kbd>c</kbd> => <kbd>m</kbd> key is not used elsewhere.
Note that, the keybindings above are just examples, please tune them up as needed to ensure they don't conflict with your other commands/plugins.
## License

View file

@ -1,4 +1,4 @@
--- @since 25.5.28
--- @since 25.5.31
local selected_or_hovered = ya.sync(function()
local tab, paths = cx.active, {}
@ -22,7 +22,8 @@ return {
local value, event = ya.input {
title = "Chmod:",
position = { "top-center", y = 3, w = 40 },
pos = { "top-center", y = 3, w = 40 },
position = { "top-center", y = 3, w = 40 }, -- TODO: remove
}
if event ~= 1 then
return

View file

@ -34,6 +34,9 @@ run = "git"
## Advanced
> [!NOTE]
> The following configuration must be put before `require("git"):setup()`
You can customize the [Style](https://yazi-rs.github.io/docs/plugins/layout#style) of the status sign with:
- `th.git.modified`

View file

@ -1,10 +1,11 @@
--- @since 25.5.28
--- @since 25.5.31
local WINDOWS = ya.target_family() == "windows"
-- The code of supported git status,
-- also used to determine which status to show for directories when they contain different statuses
-- see `bubble_up`
---@enum CODES
local CODES = {
excluded = 100, -- ignored directory
ignored = 6, -- ignored file
@ -26,6 +27,8 @@ local PATTERNS = {
{ "[AD][AD]", CODES.updated },
}
---@param line string
---@return CODES, string
local function match(line)
local signs = line:sub(1, 2)
for _, p in ipairs(PATTERNS) do
@ -41,9 +44,12 @@ local function match(line)
else
return code, path
end
---@diagnostic disable-next-line: missing-return
end
end
---@param cwd Url
---@return string?
local function root(cwd)
local is_worktree = function(url)
local file, head = io.open(tostring(url)), nil
@ -64,6 +70,8 @@ local function root(cwd)
until not cwd
end
---@param changed Changes
---@return Changes
local function bubble_up(changed)
local new, empty = {}, Url("")
for path, code in pairs(changed) do
@ -79,6 +87,10 @@ local function bubble_up(changed)
return new
end
---@param excluded string[]
---@param cwd Url
---@param repo Url
---@return Changes
local function propagate_down(excluded, cwd, repo)
local new, rel = {}, cwd:strip_prefix(repo)
for _, path in ipairs(excluded) do
@ -95,7 +107,12 @@ local function propagate_down(excluded, cwd, repo)
return new
end
---@param cwd string
---@param repo string
---@param changed Changes
local add = ya.sync(function(st, cwd, repo, changed)
---@cast st State
st.dirs[cwd] = repo
st.repos[repo] = st.repos[repo] or {}
for path, code in pairs(changed) do
@ -108,16 +125,29 @@ local add = ya.sync(function(st, cwd, repo, changed)
st.repos[repo][path] = code
end
end
ya.render()
-- TODO: remove this
if ui.render then
ui.render()
else
ya.render()
end
end)
---@param cwd string
local remove = ya.sync(function(st, cwd)
---@cast st State
local repo = st.dirs[cwd]
if not repo then
return
end
ya.render()
-- TODO: remove this
if ui.render then
ui.render()
else
ya.render()
end
st.dirs[cwd] = nil
if not st.repos[repo] then
return
@ -131,9 +161,11 @@ local remove = ya.sync(function(st, cwd)
st.repos[repo] = nil
end)
---@param st State
---@param opts Options
local function setup(st, opts)
st.dirs = {} -- Mapping between a directory and its corresponding repository
st.repos = {} -- Mapping between a repository and the status of each of its files
st.dirs = {}
st.repos = {}
opts = opts or {}
opts.order = opts.order or 1500
@ -174,6 +206,7 @@ local function setup(st, opts)
end, opts.order)
end
---@type UnstableFetcher
local function fetch(_, job)
local cwd = job.files[1].url.base
local repo = root(cwd)

View file

@ -12,7 +12,7 @@
### Yazi package manager
```bash
ya pack -a ndtoan96/ouch
ya pkg add ndtoan96/ouch
```
### Git
@ -43,8 +43,12 @@ prepend_previewers = [
{ mime = "application/x-bzip2", run = "ouch" },
{ mime = "application/x-7z-compressed", run = "ouch" },
{ mime = "application/x-rar", run = "ouch" },
{ mime = "application/x-xz", run = "ouch" },
{ mime = "application/vnd.rar", run = "ouch" },
{ mime = "application/x-xz", run = "ouch" },
{ mime = "application/xz", run = "ouch" },
{ mime = "application/x-zstd", run = "ouch" },
{ mime = "application/zstd", run = "ouch" },
{ mime = "application/java-archive", run = "ouch" },
]
```
@ -56,7 +60,7 @@ If you want to change the icon or the style of text, you can modify the `peek` f
For compession, add this to your `keymap.toml`:
```toml
[[manager.prepend_keymap]]
[[mgr.prepend_keymap]]
on = ["C"]
run = "plugin ouch"
desc = "Compress with ouch"
@ -73,7 +77,7 @@ To decompress with `ouch`, configure the opener in `yazi.toml`.
```toml
[opener]
extract = [
{ run = 'ouch d -y "%*"', desc = "Extract here with ouch", for = "windows" },
{ run = 'ouch d -y %*', desc = "Extract here with ouch", for = "windows" },
{ run = 'ouch d -y "$@"', desc = "Extract here with ouch", for = "unix" },
]
```

View file

@ -126,6 +126,7 @@ function M:entry(job)
title = "Create archive:",
value = default_name .. "." .. default_fmt,
position = { "top-center", y = 3, w = 40 },
pos = { "top-center", y = 3, w = 40 },
})
if name_event ~= 1 then
return
@ -136,6 +137,7 @@ function M:entry(job)
local confirm, confirm_event = ya.input({
title = "Overwrite " .. output_name .. "? (y/N)",
position = { "top-center", y = 3, w = 40 },
pos = { "top-center", y = 3, w = 40 },
})
if not (confirm_event == 1 and confirm:lower() == "y") then
return

View file

@ -42,6 +42,8 @@ desc = "Maximize or restore the preview pane"
You can replace `preview` with `current` or `parent` to toggle the other panes.
Note that, the keybindings above are just examples, please tune them up as needed to ensure they don't conflict with your other commands/plugins.
## Advanced
In addition to triggering the plugin with a keypress, you can also trigger it in your `init.lua` file:

View file

@ -1,4 +1,4 @@
--- @since 25.5.28
--- @since 25.5.31
--- @sync entry
local function entry(st, job)

View file

@ -1,3 +1,4 @@
--- @since 25.5.31
--- @diagnostic disable: undefined-global, undefined-field
--- @alias Mode Mode Comes from Yazi.
--- @alias Rect Rect Comes from Yazi.
@ -1316,7 +1317,7 @@ return {
Progress.partial_render = function(self)
local progress = cx.tasks.progress
if progress.total == 0 then
return { config_paragraph(self._area) }
return config_paragraph(self._area)
end
local gauge = ui.Gauge():area(self._area)
@ -1332,11 +1333,9 @@ return {
end
local left = progress.total - progress.succ
return {
gauge
:percent(percent)
:label(ui.Span(string.format("%3d%%, %d left", percent, left)):style(th.status.progress_label)),
}
return gauge
:percent(percent)
:label(ui.Span(string.format("%3d%%, %d left", percent, left)):style(th.status.progress_label))
end
if display_header_line then
@ -1347,7 +1346,7 @@ return {
return {
config_paragraph(self._area, left_line),
ui.Text(right_line):area(self._area):align(ui.Text.RIGHT),
right_line:area(self._area):align(ui.Align.RIGHT),
}
end
@ -1373,8 +1372,8 @@ return {
return {
config_paragraph(self._area, left_line),
ui.Text(right_line):area(self._area):align(ui.Text.RIGHT),
table.unpack(Progress:new(self._area, right_width):redraw()),
right_line:area(self._area):align(ui.Align.RIGHT),
table.unpack(ui.redraw(Progress:new(self._area, right_width))),
}
end
@ -1423,6 +1422,8 @@ return {
end
end
table.insert(childrens, Modal:new(self._area))
self._children = childrens
end
end,