update lua config
This commit is contained in:
parent
768e4e1b9e
commit
e474f94fb6
14 changed files with 417 additions and 66 deletions
|
@ -7,7 +7,7 @@ https://github.com/yazi-rs/plugins/assets/17523360/7aa3abc2-d057-498c-8473-a6282
|
|||
## Installation
|
||||
|
||||
```sh
|
||||
ya pack -a yazi-rs/plugins:chmod
|
||||
ya pkg add yazi-rs/plugins:chmod
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
@ -15,7 +15,7 @@ ya pack -a yazi-rs/plugins:chmod
|
|||
Add this to your `~/.config/yazi/keymap.toml`:
|
||||
|
||||
```toml
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = [ "c", "m" ]
|
||||
run = "plugin chmod"
|
||||
desc = "Chmod on selected files"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
--- @since 25.2.26
|
||||
--- @since 25.5.28
|
||||
|
||||
local selected_or_hovered = ya.sync(function()
|
||||
local tab, paths = cx.active, {}
|
||||
|
@ -13,7 +13,7 @@ end)
|
|||
|
||||
return {
|
||||
entry = function()
|
||||
ya.mgr_emit("escape", { visual = true })
|
||||
ya.emit("escape", { visual = true })
|
||||
|
||||
local urls = selected_or_hovered()
|
||||
if #urls == 0 then
|
||||
|
@ -28,7 +28,7 @@ return {
|
|||
return
|
||||
end
|
||||
|
||||
local status, err = Command("chmod"):arg(value):args(urls):spawn():wait()
|
||||
local status, err = Command("chmod"):arg(value):arg(urls):spawn():wait()
|
||||
if not status or not status.success then
|
||||
ya.notify {
|
||||
title = "Chmod",
|
||||
|
|
|
@ -7,7 +7,7 @@ Add a full border to Yazi to make it look fancier.
|
|||
## Installation
|
||||
|
||||
```sh
|
||||
ya pack -a yazi-rs/plugins:full-border
|
||||
ya pkg add yazi-rs/plugins:full-border
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
|
|
@ -7,10 +7,10 @@ local function setup(_, opts)
|
|||
Tab.build = function(self, ...)
|
||||
local bar = function(c, x, y)
|
||||
if x <= 0 or x == self._area.w - 1 or th.mgr.border_symbol ~= "│" then
|
||||
return ui.Bar(ui.Bar.TOP)
|
||||
return ui.Bar(ui.Edge.TOP)
|
||||
end
|
||||
|
||||
return ui.Bar(ui.Bar.TOP)
|
||||
return ui.Bar(ui.Edge.TOP)
|
||||
:area(
|
||||
ui.Rect { x = x, y = math.max(0, y), w = ya.clamp(0, self._area.w - x, 1), h = math.min(1, self._area.h) }
|
||||
)
|
||||
|
@ -26,9 +26,9 @@ local function setup(_, opts)
|
|||
|
||||
local style = th.mgr.border_style
|
||||
self._base = ya.list_merge(self._base or {}, {
|
||||
ui.Border(ui.Border.ALL):area(self._area):type(type):style(style),
|
||||
ui.Bar(ui.Bar.RIGHT):area(self._chunks[1]):style(style),
|
||||
ui.Bar(ui.Bar.LEFT):area(self._chunks[3]):style(style),
|
||||
ui.Border(ui.Edge.ALL):area(self._area):type(type):style(style),
|
||||
ui.Bar(ui.Edge.RIGHT):area(self._chunks[1]):style(style),
|
||||
ui.Bar(ui.Edge.LEFT):area(self._chunks[3]):style(style),
|
||||
|
||||
bar("┬", c[1].right - 1, c[1].y),
|
||||
bar("┴", c[1].right - 1, c[1].bottom - 1),
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
# git.yazi
|
||||
|
||||
> [!NOTE]
|
||||
> Yazi v25.2.26 or later is required for this plugin to work.
|
||||
|
||||
Show the status of Git file changes as linemode in the file list.
|
||||
|
||||
https://github.com/user-attachments/assets/34976be9-a871-4ffe-9d5a-c4cdd0bf4576
|
||||
|
@ -10,7 +7,7 @@ https://github.com/user-attachments/assets/34976be9-a871-4ffe-9d5a-c4cdd0bf4576
|
|||
## Installation
|
||||
|
||||
```sh
|
||||
ya pack -a yazi-rs/plugins:git
|
||||
ya pkg add yazi-rs/plugins:git
|
||||
```
|
||||
|
||||
## Setup
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
--- @since 25.4.4
|
||||
--- @since 25.5.28
|
||||
|
||||
local WINDOWS = ya.target_family() == "windows"
|
||||
|
||||
|
@ -190,8 +190,8 @@ local function fetch(_, job)
|
|||
-- stylua: ignore
|
||||
local output, err = Command("git")
|
||||
:cwd(tostring(cwd))
|
||||
:args({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" })
|
||||
:args(paths)
|
||||
:arg({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" })
|
||||
:arg(paths)
|
||||
:stdout(Command.PIPED)
|
||||
:output()
|
||||
if not output then
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# toggle-pane.yazi
|
||||
|
||||
Toggle the show, hide, and maximize states for different panes: parent, current, and preview. It respects the user's [`ratio` settings](https://yazi-rs.github.io/docs/configuration/yazi#manager.ratio)!
|
||||
Toggle the show, hide, and maximize states for different panes: parent, current, and preview. It respects the user's [`ratio` settings](https://yazi-rs.github.io/docs/configuration/yazi#mgr.ratio)!
|
||||
|
||||
Assume the user's `ratio` is $$[A, B, C]$$, that is, $$\text{parent}=A, \text{current}=B, \text{preview}=C$$:
|
||||
|
||||
|
@ -15,7 +15,7 @@ Assume the user's `ratio` is $$[A, B, C]$$, that is, $$\text{parent}=A, \text{cu
|
|||
## Installation
|
||||
|
||||
```sh
|
||||
ya pack -a yazi-rs/plugins:toggle-pane
|
||||
ya pkg add yazi-rs/plugins:toggle-pane
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
@ -24,7 +24,7 @@ Hide/Show preview:
|
|||
|
||||
```toml
|
||||
# keymap.toml
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "T"
|
||||
run = "plugin toggle-pane min-preview"
|
||||
desc = "Show or hide the preview pane"
|
||||
|
@ -34,7 +34,7 @@ Maximize/Restore preview:
|
|||
|
||||
```toml
|
||||
# keymap.toml
|
||||
[[manager.prepend_keymap]]
|
||||
[[mgr.prepend_keymap]]
|
||||
on = "T"
|
||||
run = "plugin toggle-pane max-preview"
|
||||
desc = "Maximize or restore the preview pane"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
--- @since 25.2.26
|
||||
--- @since 25.5.28
|
||||
--- @sync entry
|
||||
|
||||
local function entry(st, job)
|
||||
|
@ -39,13 +39,7 @@ local function entry(st, job)
|
|||
Tab.layout, st.old = st.old, nil
|
||||
st.parent, st.current, st.preview = nil, nil, nil
|
||||
end
|
||||
|
||||
-- TODO: remove this in the future
|
||||
if ya.emit then
|
||||
ya.emit("app:resize", {})
|
||||
else
|
||||
ya.app_emit("resize", {})
|
||||
end
|
||||
ya.emit("app:resize", {})
|
||||
end
|
||||
|
||||
return { entry = entry }
|
||||
|
|
|
@ -227,16 +227,18 @@ return {
|
|||
local callback = function()
|
||||
local cwd = cx.active.current.cwd
|
||||
|
||||
if this.cwd ~= cwd then
|
||||
this.cwd = cwd
|
||||
ya.manager_emit("plugin", {
|
||||
this._id,
|
||||
ya.quote(tostring(cwd), true),
|
||||
})
|
||||
end
|
||||
ya.emit("plugin", {
|
||||
this._id,
|
||||
ya.quote(tostring(cwd), true),
|
||||
})
|
||||
end
|
||||
|
||||
ps.sub("cd", callback)
|
||||
ps.sub("rename", callback)
|
||||
ps.sub("bulk", callback)
|
||||
ps.sub("move", callback)
|
||||
ps.sub("trash", callback)
|
||||
ps.sub("delete", callback)
|
||||
ps.sub("tab", callback)
|
||||
|
||||
if Yatline ~= nil then
|
||||
|
@ -244,6 +246,10 @@ return {
|
|||
local status = this.output
|
||||
local githead = {}
|
||||
|
||||
if not status then
|
||||
return githead
|
||||
end
|
||||
|
||||
local branch = config.show_branch and get_branch(status) or ""
|
||||
if branch ~= nil and branch ~= "" then
|
||||
table.insert(githead, { branch[2], theme.prefix_color })
|
||||
|
@ -301,7 +307,7 @@ return {
|
|||
entry = function(_, job)
|
||||
local args = job.args or job
|
||||
local command = Command("git")
|
||||
:args({ "status", "--ignore-submodules=dirty", "--branch", "--show-stash", "--ahead-behind" })
|
||||
:arg({ "status", "--ignore-submodules=dirty", "--branch", "--show-stash", "--ahead-behind" })
|
||||
:cwd(args[1])
|
||||
:env("LANGUAGE", "en_US.UTF-8")
|
||||
:stdout(Command.PIPED)
|
||||
|
|
|
@ -424,12 +424,20 @@ function Yatline.string.get:hovered_mime()
|
|||
end
|
||||
|
||||
--- Gets the hovered file's user and group ownership of the current active tab.
|
||||
--- Unix-like systems only.
|
||||
--- @return string ownership Current active tab's hovered file's user and group ownership.
|
||||
function Yatline.string.get:hovered_ownership()
|
||||
local hovered = cx.active.current.hovered
|
||||
|
||||
if hovered then
|
||||
return ya.user_name(hovered.cha.uid) .. ":" .. ya.group_name(hovered.cha.gid)
|
||||
if not hovered.cha.uid or not hovered.cha.gid then
|
||||
return ""
|
||||
end
|
||||
|
||||
local username = ya.user_name(hovered.cha.uid) or tostring(hovered.cha.uid)
|
||||
local groupname = ya.group_name(hovered.cha.gid) or tostring(hovered.cha.gid)
|
||||
|
||||
return username .. ":" .. groupname
|
||||
else
|
||||
return ""
|
||||
end
|
||||
|
@ -713,6 +721,7 @@ function Yatline.coloreds.create(coloreds, component_type)
|
|||
end
|
||||
|
||||
--- Gets the hovered file's permissions of the current active tab.
|
||||
--- Unix-like systems only.
|
||||
--- @return Coloreds coloreds Current active tab's hovered file's permissions
|
||||
function Yatline.coloreds.get:permissions()
|
||||
local hovered = cx.active.current.hovered
|
||||
|
@ -990,8 +999,10 @@ local function config_side(side)
|
|||
|
||||
if component_group then
|
||||
if component.custom then
|
||||
section_components[#section_components + 1] =
|
||||
{ component_group.create(component.name, in_section), component_group.has_separator }
|
||||
if component.name ~= nil and component.name ~= "" and #component.name ~= 0 then
|
||||
section_components[#section_components + 1] =
|
||||
{ component_group.create(component.name, in_section), component_group.has_separator }
|
||||
end
|
||||
else
|
||||
local getter = component_group.get[component.name]
|
||||
|
||||
|
@ -1075,9 +1086,65 @@ local function config_paragraph(area, line)
|
|||
end
|
||||
|
||||
return {
|
||||
setup = function(_, config)
|
||||
setup = function(_, config, pre_theme)
|
||||
config = config or {}
|
||||
|
||||
if config == 0 then
|
||||
config = {
|
||||
show_background = false,
|
||||
|
||||
header_line = {
|
||||
left = {
|
||||
section_a = {
|
||||
{ type = "line", custom = false, name = "tabs", params = { "left" } },
|
||||
},
|
||||
section_b = {},
|
||||
section_c = {},
|
||||
},
|
||||
right = {
|
||||
section_a = {
|
||||
{ type = "string", custom = false, name = "date", params = { "%A, %d %B %Y" } },
|
||||
},
|
||||
section_b = {
|
||||
{ type = "string", custom = false, name = "date", params = { "%X" } },
|
||||
},
|
||||
section_c = {},
|
||||
},
|
||||
},
|
||||
|
||||
status_line = {
|
||||
left = {
|
||||
section_a = {
|
||||
{ type = "string", custom = false, name = "tab_mode" },
|
||||
},
|
||||
section_b = {
|
||||
{ type = "string", custom = false, name = "hovered_size" },
|
||||
},
|
||||
section_c = {
|
||||
{ type = "string", custom = false, name = "hovered_path" },
|
||||
{ type = "coloreds", custom = false, name = "count" },
|
||||
},
|
||||
},
|
||||
right = {
|
||||
section_a = {
|
||||
{ type = "string", custom = false, name = "cursor_position" },
|
||||
},
|
||||
section_b = {
|
||||
{ type = "string", custom = false, name = "cursor_percentage" },
|
||||
},
|
||||
section_c = {
|
||||
{ type = "string", custom = false, name = "hovered_file_extension", params = { true } },
|
||||
{ type = "coloreds", custom = false, name = "permissions" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
if pre_theme then
|
||||
config.theme = pre_theme
|
||||
end
|
||||
|
||||
tab_width = config.tab_width or 20
|
||||
|
||||
local component_positions = config.component_positions or { "header", "tab", "status" }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue