Delete dot_config/yazi/plugins directory

This commit is contained in:
2025-04-22 14:39:15 +01:00
committed by GitHub
parent 3dff1c6c08
commit 527dea2904
24 changed files with 0 additions and 2257 deletions

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,28 +0,0 @@
# chmod.yazi
Execute `chmod` on the selected files to change their mode. This plugin is only available on Unix platforms since it relies on [`chmod(2)`](https://man7.org/linux/man-pages/man2/chmod.2.html).
https://github.com/yazi-rs/plugins/assets/17523360/7aa3abc2-d057-498c-8473-a6282c59c464
## Installation
```sh
ya pack -a yazi-rs/plugins:chmod
```
## Usage
Add this to your `~/.config/yazi/keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = [ "c", "m" ]
run = "plugin chmod"
desc = "Chmod on selected files"
```
Make sure the <kbd>c</kbd> => <kbd>m</kbd> key is not used elsewhere.
## License
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.

View File

@@ -1,41 +0,0 @@
--- @since 25.2.7
local selected_or_hovered = ya.sync(function()
local tab, paths = cx.active, {}
for _, u in pairs(tab.selected) do
paths[#paths + 1] = tostring(u)
end
if #paths == 0 and tab.current.hovered then
paths[1] = tostring(tab.current.hovered.url)
end
return paths
end)
return {
entry = function()
ya.manager_emit("escape", { visual = true })
local urls = selected_or_hovered()
if #urls == 0 then
return ya.notify { title = "Chmod", content = "No file selected", level = "warn", timeout = 5 }
end
local value, event = ya.input {
title = "Chmod:",
position = { "top-center", y = 3, w = 40 },
}
if event ~= 1 then
return
end
local status, err = Command("chmod"):arg(value):args(urls):spawn():wait()
if not status or not status.success then
ya.notify {
title = "Chmod",
content = string.format("Chmod on selected files failed, error: %s", status and status.code or err),
level = "error",
timeout = 5,
}
end
end,
}

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,32 +0,0 @@
# full-border.yazi
Add a full border to Yazi to make it look fancier.
![full-border](https://github.com/yazi-rs/plugins/assets/17523360/ef81b560-2465-4d36-abf2-5d21dcb7b987)
## Installation
```sh
ya pack -a yazi-rs/plugins:full-border
```
## Usage
Add this to your `init.lua` to enable the plugin:
```lua
require("full-border"):setup()
```
Or you can customize the border type:
```lua
require("full-border"):setup {
-- Available values: ui.Border.PLAIN, ui.Border.ROUNDED
type = ui.Border.ROUNDED,
}
```
## License
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.

View File

@@ -1,43 +0,0 @@
--- @since 25.2.7
local function setup(_, opts)
local type = opts and opts.type or ui.Border.ROUNDED
local old_build = Tab.build
Tab.build = function(self, ...)
local bar = function(c, x, y)
if x <= 0 or x == self._area.w - 1 then
return ui.Bar(ui.Bar.TOP)
end
return ui.Bar(ui.Bar.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) }
)
:symbol(c)
end
local c = self._chunks
self._chunks = {
c[1]:pad(ui.Pad.y(1)),
c[2]:pad(ui.Pad(1, c[3].w > 0 and 0 or 1, 1, c[1].w > 0 and 0 or 1)),
c[3]:pad(ui.Pad.y(1)),
}
local style = THEME.manager.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),
bar("", c[1].right - 1, c[1].y),
bar("", c[1].right - 1, c[1].bottom - 1),
bar("", c[2].right, c[2].y),
bar("", c[2].right, c[2].bottom - 1),
})
old_build(self, ...)
end
end
return { setup = setup }

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,78 +0,0 @@
# git.yazi
> [!NOTE]
> Yazi v25.2.7 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
## Installation
```sh
ya pack -a yazi-rs/plugins:git
```
## Setup
Add the following to your `~/.config/yazi/init.lua`:
```lua
require("git"):setup()
```
And register it as fetchers in your `~/.config/yazi/yazi.toml`:
```toml
[[plugin.prepend_fetchers]]
id = "git"
name = "*"
run = "git"
[[plugin.prepend_fetchers]]
id = "git"
name = "*/"
run = "git"
```
## Advanced
You can customize the [Style](https://yazi-rs.github.io/docs/plugins/layout#style) of the status sign with:
- `THEME.git.modified`
- `THEME.git.added`
- `THEME.git.untracked`
- `THEME.git.ignored`
- `THEME.git.deleted`
- `THEME.git.updated`
For example:
```lua
-- ~/.config/yazi/init.lua
THEME.git = THEME.git or {}
THEME.git.modified = ui.Style():fg("blue")
THEME.git.deleted = ui.Style():fg("red"):bold()
```
You can also customize the text of the status sign with:
- `THEME.git.modified_sign`
- `THEME.git.added_sign`
- `THEME.git.untracked_sign`
- `THEME.git.ignored_sign`
- `THEME.git.deleted_sign`
- `THEME.git.updated_sign`
For example:
```lua
-- ~/.config/yazi/init.lua
THEME.git = THEME.git or {}
THEME.git.modified_sign = "M"
THEME.git.deleted_sign = "D"
```
## License
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.

View File

@@ -1,209 +0,0 @@
--- @since 25.2.7
local WIN = ya.target_family() == "windows"
local PATS = {
{ "[MT]", 6 }, -- Modified
{ "[AC]", 5 }, -- Added
{ "?$", 4 }, -- Untracked
{ "!$", 3 }, -- Ignored
{ "D", 2 }, -- Deleted
{ "U", 1 }, -- Updated
{ "[AD][AD]", 1 }, -- Updated
}
local function match(line)
local signs = line:sub(1, 2)
for _, p in ipairs(PATS) do
local path
if signs:find(p[1]) then
path = line:sub(4, 4) == '"' and line:sub(5, -2) or line:sub(4)
path = WIN and path:gsub("/", "\\") or path
end
if not path then
elseif path:find("[/\\]$") then
return p[2] == 3 and 30 or p[2], path:sub(1, -2)
else
return p[2], path
end
end
end
local function root(cwd)
local is_worktree = function(url)
local file, head = io.open(tostring(url)), nil
if file then
head = file:read(8)
file:close()
end
return head == "gitdir: "
end
repeat
local next = cwd:join(".git")
local cha = fs.cha(next)
if cha and (cha.is_dir or is_worktree(next)) then
return tostring(cwd)
end
cwd = cwd:parent()
until not cwd
end
local function bubble_up(changed)
local new, empty = {}, Url("")
for k, v in pairs(changed) do
if v ~= 3 and v ~= 30 then
local url = Url(k):parent()
while url and url ~= empty do
local s = tostring(url)
new[s] = (new[s] or 0) > v and new[s] or v
url = url:parent()
end
end
end
return new
end
local function propagate_down(ignored, cwd, repo)
local new, rel = {}, cwd:strip_prefix(repo)
for k, v in pairs(ignored) do
if v == 30 then
if rel:starts_with(k) then
new[tostring(repo:join(rel))] = 30
elseif cwd == repo:join(k):parent() then
new[k] = 3
end
end
end
return new
end
local add = ya.sync(function(st, cwd, repo, changed)
st.dirs[cwd] = repo
st.repos[repo] = st.repos[repo] or {}
for k, v in pairs(changed) do
if v == 0 then
st.repos[repo][k] = nil
elseif v == 30 then
st.dirs[k] = ""
else
st.repos[repo][k] = v
end
end
ya.render()
end)
local remove = ya.sync(function(st, cwd)
local dir = st.dirs[cwd]
if not dir then
return
end
ya.render()
st.dirs[cwd] = nil
if not st.repos[dir] then
return
end
for _, r in pairs(st.dirs) do
if r == dir then
return
end
end
st.repos[dir] = nil
end)
local function setup(st, opts)
st.dirs = {}
st.repos = {}
opts = opts or {}
opts.order = opts.order or 1500
-- Chosen by ChatGPT fairly, PRs are welcome to adjust them
local t = THEME.git or {}
local styles = {
[6] = t.modified and ui.Style(t.modified) or ui.Style():fg("#ffa500"),
[5] = t.added and ui.Style(t.added) or ui.Style():fg("#32cd32"),
[4] = t.untracked and ui.Style(t.untracked) or ui.Style():fg("#a9a9a9"),
[3] = t.ignored and ui.Style(t.ignored) or ui.Style():fg("#696969"),
[2] = t.deleted and ui.Style(t.deleted) or ui.Style():fg("#ff4500"),
[1] = t.updated and ui.Style(t.updated) or ui.Style():fg("#1e90ff"),
}
local signs = {
[6] = t.modified_sign and t.modified_sign or "",
[5] = t.added_sign and t.added_sign or "",
[4] = t.untracked_sign and t.untracked_sign or "",
[3] = t.ignored_sign and t.ignored_sign or "",
[2] = t.deleted_sign and t.deleted_sign or "",
[1] = t.updated_sign and t.updated_sign or "U",
}
Linemode:children_add(function(self)
local url = self._file.url
local dir = st.dirs[tostring(url:parent())]
local change
if dir then
change = dir == "" and 3 or st.repos[dir][tostring(url):sub(#dir + 2)]
end
if not change or signs[change] == "" then
return ""
elseif self._file:is_hovered() then
return ui.Line { " ", signs[change] }
else
return ui.Line { " ", ui.Span(signs[change]):style(styles[change]) }
end
end, opts.order)
end
local function fetch(_, job)
local cwd = job.files[1].url:parent()
local repo = root(cwd)
if not repo then
remove(tostring(cwd))
return true
end
local paths = {}
for _, f in ipairs(job.files) do
paths[#paths + 1] = tostring(f.url)
end
-- 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)
:stdout(Command.PIPED)
:output()
if not output then
return true, Err("Cannot spawn `git` command, error: %s", err)
end
local changed, ignored = {}, {}
for line in output.stdout:gmatch("[^\r\n]+") do
local sign, path = match(line)
if sign == 30 then
ignored[path] = sign
else
changed[path] = sign
end
end
if job.files[1].cha.is_dir then
ya.dict_merge(changed, bubble_up(changed))
ya.dict_merge(changed, propagate_down(ignored, cwd, Url(repo)))
else
ya.dict_merge(changed, propagate_down(ignored, cwd, Url(repo)))
end
for _, p in ipairs(paths) do
local s = p:sub(#repo + 2)
changed[s] = changed[s] or 0
end
add(tostring(cwd), repo, changed)
return false
end
return { setup = setup, fetch = fetch }

View File

@@ -1,7 +0,0 @@
Copyright © 2024 Reledia <reledia@prontonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,30 +0,0 @@
# glow.yazi
Plugin for [Yazi](https://github.com/sxyazi/yazi) to preview markdown files with [glow](https://github.com/charmbracelet/glow). To install, run the below mentioned command:
```bash
ya pack -a Reledia/glow
```
then include it in your `yazi.toml` to use:
```toml
[plugin]
prepend_previewers = [
{ name = "*.md", run = "glow" },
]
```
Make sure you have [glow](https://github.com/charmbracelet/glow) installed, and can be found in `PATH`.
## Feature
+ You can modify line wrap in `init.lua`, the current value is 55.
+ You can press `ctrl+e` to scroll up and `ctrl+y` to scroll down the readme file in preview panel in yazi: (add this to `keymap.toml`)
```toml
prepend_keymap = [
# glow.yazi
{ on = ["<C-e>"], run = "seek 5" },
{ on = ["<C-y>"], run = "seek -5" },
]
```

View File

@@ -1,76 +0,0 @@
local M = {}
function M:peek(job)
-- Set a fixed width of 55 characters for the preview
local preview_width = 55
local child = Command("glow")
:args({
"--style",
"dark",
"--width",
tostring(preview_width), -- Use fixed width instead of job.area.w
tostring(job.file.url),
})
:env("CLICOLOR_FORCE", "1")
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:spawn()
if not child then
return require("code").peek(job)
end
local limit = job.area.h
local i, lines = 0, ""
repeat
local next, event = child:read_line()
if event == 1 then
return require("code").peek(job)
elseif event ~= 0 then
break
end
i = i + 1
if i > job.skip then
lines = lines .. next
end
until i >= job.skip + limit
child:start_kill()
if job.skip > 0 and i < job.skip + limit then
ya.manager_emit("peek", {
tostring(math.max(0, i - limit)),
only_if = job.file.url,
upper_bound = true
})
else
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) })
end
end
function M:seek(job)
local h = cx.active.current.hovered
if not h or h.url ~= job.file.url then
return
end
local scroll_amount = 1
local scroll_offset = job.units
if job.key == "ctrl-e" then
scroll_offset = scroll_amount
elseif job.key == "ctrl-y" then
scroll_offset = -scroll_amount
else
scroll_offset = job.units
end
ya.manager_emit('peek', {
math.max(0, cx.active.preview.skip + scroll_offset),
only_if = job.file.url,
})
end
return M

View File

@@ -1,7 +0,0 @@
Copyright © 2024 Reledia <reledia@prontonmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,22 +0,0 @@
# hexyl.yazi
Preview any file on [Yazi](https://github.com/sxyazi/yazi) using [hexyl](https://github.com/sharkdp/hexyl). To install, use the `ya pack` cli utility:
```bash
ya pack -a Reledia/hexyl
```
then include it in your `yazi.toml` to use:
```toml
[plugin]
append_previewers = [
{ name = "*", run = "hexyl" },
]
```
Make sure you have [hexyl](https://github.com/sharkdp/hexyl) installed, and that can be found in `PATH`.
## Preview
![preview.png](https://raw.githubusercontent.com/Reledia/hexyl.yazi/main/image.png)

View File

@@ -1,57 +0,0 @@
local M = {}
function M:peek(job)
local child
local l = self.file.cha.len
if l == 0 then
child = Command("hexyl")
:args({
tostring(job.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:spawn()
else
child = Command("hexyl")
:args({
"--border",
"none",
"--terminal-width",
tostring(job.area.w),
tostring(job.file.url),
})
:stdout(Command.PIPED)
:stderr(Command.PIPED)
:spawn()
end
local limit = job.area.h
local i, lines = 0, ""
repeat
local next, event = child:read_line()
if event == 1 then
ya.err(tostring(event))
elseif event ~= 0 then
break
end
i = i + 1
if i > job.skip then
lines = lines .. next
end
until i >= job.skip + limit
child:start_kill()
if job.skip > 0 and i < job.skip + limit then
ya.manager_emit("peek", { math.max(0, i - limit), only_if = job.file.url, upper_bound = true })
else
lines = lines:gsub("\t", string.rep(" ", PREVIEW.tab_size))
ya.preview_widgets(job, { ui.Text.parse(lines):area(job.area) })
end
end
function M:seek(units)
require("code").seek(job, units)
end
return M

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,47 +0,0 @@
# max-preview.yazi
Maximize or restore the preview pane.
https://github.com/yazi-rs/plugins/assets/17523360/8976308e-ebfe-4e9e-babe-153eb1f87d61
## Installation
```sh
ya pack -a yazi-rs/plugins:max-preview
```
## Usage
Add this to your `~/.config/yazi/keymap.toml`:
```toml
[[manager.prepend_keymap]]
on = "T"
run = "plugin max-preview"
desc = "Maximize or restore preview"
```
Make sure the <kbd>T</kbd> key is not used elsewhere.
## Tips
This plugin only maximizes the "available preview area", without actually changing the content size.
This means that the appearance of your preview largely depends on the previewer you are using.
However, most previewers tend to make the most of the available space, so this usually isn't an issue.
For image previews, you may want to tune up the [`max_width`][max-width] and [`max_height`][max-height] options in your `yazi.toml`:
```toml
[preview]
# Change them to your desired values
max_width = 1000
max_height = 1000
```
[max-width]: https://yazi-rs.github.io/docs/configuration/yazi/#preview.max_width
[max-height]: https://yazi-rs.github.io/docs/configuration/yazi/#preview.max_height
## License
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.

View File

@@ -1,25 +0,0 @@
--- @since 25.2.7
--- @sync entry
local function entry(st)
if st.old then
Tab.layout, st.old = st.old, nil
else
st.old = Tab.layout
Tab.layout = function(self)
self._chunks = ui.Layout()
:direction(ui.Layout.HORIZONTAL)
:constraints({
ui.Constraint.Percentage(0),
ui.Constraint.Percentage(0),
ui.Constraint.Percentage(100),
})
:split(self._area)
end
end
ya.app_emit("resize", {})
end
local function enabled(st) return st.old ~= nil end
return { entry = entry, enabled = enabled }

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 yazi-rs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,56 +0,0 @@
# mime-ext.yazi
A mime-type provider based on a file extension database, replacing the [builtin `file(1)`](https://github.com/sxyazi/yazi/blob/main/yazi-plugin/preset/plugins/mime.lua) to speed up mime-type retrieval at the expense of accuracy.
See https://yazi-rs.github.io/docs/tips#make-yazi-even-faster for more information.
## Installation
```sh
ya pack -a yazi-rs/plugins:mime-ext
```
## Usage
Add this to your `~/.config/yazi/yazi.toml`:
```toml
[[plugin.prepend_fetchers]]
id = "mime"
name = "*"
run = "mime-ext"
prio = "high"
```
## Advanced
You can also customize it in your `~/.config/yazi/init.lua` with:
```lua
require("mime-ext"):setup {
-- Expand the existing filename database (lowercase), for example:
with_files = {
makefile = "text/makefile",
-- ...
},
-- Expand the existing extension database (lowercase), for example:
with_exts = {
mk = "text/makefile",
-- ...
},
-- If the mime-type is not in both filename and extension databases,
-- then fallback to Yazi's preset `mime` plugin, which uses `file(1)`
fallback_file1 = false,
}
```
## TODO
- Add more file types (PRs welcome!).
- Compress mime-type tables.
## License
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.

File diff suppressed because it is too large Load Diff

View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2024 Rolv Apneseth
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,109 +0,0 @@
# starship.yazi
Starship prompt plugin for [Yazi](https://github.com/sxyazi/yazi)
<https://github.com/Rolv-Apneseth/starship.yazi/assets/69486699/f7314687-5cb1-4d66-8d9d-cca960ba6716>
## Requirements
- [Yazi](https://github.com/sxyazi/yazi)
- [starship](https://github.com/starship/starship)
## Installation
```bash
ya pack -a Rolv-Apneseth/starship
```
### Manual
```sh
# Linux / MacOS
git clone https://github.com/Rolv-Apneseth/starship.yazi.git ~/.config/yazi/plugins/starship.yazi
# Windows
git clone https://github.com/Rolv-Apneseth/starship.yazi.git %AppData%\yazi\config\plugins\starship.yazi
```
## Usage
Add this to `~/.config/yazi/init.lua`:
```lua
require("starship"):setup()
```
Make sure you have [starship](https://github.com/starship/starship) installed and in your `PATH`.
## Config
Here is an example with all available config options:
```lua
require("starship"):setup({
-- Hide flags (such as filter, find and search). This is recommended for starship themes which
-- are intended to go across the entire width of the terminal.
hide_flags = false, -- Default: false
-- Whether to place flags after the starship prompt. False means the flags will be placed before the prompt.
flags_after_prompt = true, -- Default: true
-- Custom starship configuration file to use
config_file = "~/.config/starship_full.toml", -- Default: nil
})
```
## Extra
If you use a `starship` theme with a background colour, it might look a bit to cramped on just the one line `Yazi` gives the header by default. To fix this, you can add this to your `init.lua`:
<details>
<summary>Click to expand</summary>
```lua
local old_build = Tab.build
Tab.build = function(self, ...)
local bar = function(c, x, y)
if x <= 0 or x == self._area.w - 1 then
return ui.Bar(ui.Bar.TOP):area(ui.Rect.default)
end
return ui.Bar(ui.Bar.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),
}))
:symbol(c)
end
local c = self._chunks
self._chunks = {
c[1]:padding(ui.Padding.y(1)),
c[2]:padding(ui.Padding(c[1].w > 0 and 0 or 1, c[3].w > 0 and 0 or 1, 1, 1)),
c[3]:padding(ui.Padding.y(1)),
}
local style = THEME.manager.border_style
self._base = ya.list_merge(self._base or {}, {
ui.Border(ui.Border.ALL):area(self._area):type(ui.Border.ROUNDED):style(style),
ui.Bar(ui.Bar.RIGHT):area(self._chunks[1]):style(style),
ui.Bar(ui.Bar.LEFT):area(self._chunks[1]):style(style),
bar("", c[1].right - 1, c[1].y),
bar("", c[1].right - 1, c[1].bottom - 1),
bar("", c[2].right, c[2].y),
bar("", c[2].right, c[2].bottom - 1),
})
old_build(self, ...)
end
```
</details>
> [!NOTE]
> This works by overriding your `Tab.build` function so make sure this is the only place you're doing that in your config. For example, this would be incompatible with the [full-border plugin](https://github.com/yazi-rs/plugins/tree/main/full-border.yazi)
## Thanks
- [sxyazi](https://github.com/sxyazi) for providing the code for this plugin and the demo video [in this comment](https://github.com/sxyazi/yazi/issues/767#issuecomment-1977082834)

View File

@@ -1,138 +0,0 @@
--- @since 25.2.7
-- For development
--[[ local function notify(message) ]]
--[[ ya.notify({ title = "Starship", content = message, timeout = 5 }) ]]
--[[ end ]]
local save = ya.sync(function(st, cwd, output)
if cx.active.current.cwd == Url(cwd) then
st.output = output
ya.render()
end
end)
-- Helper function for accessing the `config_file` state variable
---@return string
local get_config_file = ya.sync(function(st)
return st.config_file
end)
return {
---User arguments for setup method
---@class SetupArgs
---@field config_file string Absolute path to a starship config file
---@field hide_flags boolean Whether to hide all flags (such as filter and search). Recommended for themes which are intended to take the full width of the terminal.
---@field flags_after_prompt boolean Whether to place flags (such as filter and search) after the starship prompt. By default this is true.
--- Setup plugin
--- @param st table State
--- @param args SetupArgs|nil
setup = function(st, args)
local hide_flags = false
local flags_after_prompt = true
-- Check setup args
if args ~= nil then
if args.config_file ~= nil then
local url = Url(args.config_file)
if url.is_regular then
local config_file = args.config_file
-- Manually replace '~' and '$HOME' at the start of the path with the OS environment variable
local home = os.getenv("HOME")
if home then
home = tostring(home)
config_file = config_file:gsub("^~", home):gsub("^$HOME", home)
end
st.config_file = config_file
end
end
if args.hide_flags ~= nil then
hide_flags = args.hide_flags
end
if args.flags_after_prompt ~= nil then
flags_after_prompt = args.flags_after_prompt
end
end
-- Replace default header widget
Header:children_remove(1, Header.LEFT)
Header:children_add(function(self)
local max = self._area.w - self._right_width
if max <= 0 then
return ""
end
if hide_flags or not st.output then
return ui.Line.parse(st.output or "")
end
-- Split `st.output` at the first line break (or keep as is if none was found)
local output = st.output:match("([^\n]*)\n?") or st.output
local flags = self:flags()
if flags_after_prompt then
output = output .. " " .. flags
else
output = flags .. " " .. output
end
return ui.Line.parse(output)
end, 1000, Header.LEFT)
-- Pass current working directory and custom config path (if specified) to the plugin's entry point
---Callback for subscribers to update the prompt
local callback = function()
local cwd = cx.active.current.cwd
if st.cwd ~= cwd then
st.cwd = cwd
if ya.confirm then
-- >= yazi 25.2.7
ya.manager_emit("plugin", {
st._id,
ya.quote(tostring(cwd), true),
})
else
-- < yazi 25.2.7
ya.manager_emit("plugin", {
st._id,
args = ya.quote(tostring(cwd), true),
})
end
end
end
-- Subscribe to events
ps.sub("cd", callback)
ps.sub("tab", callback)
end,
entry = function(_, job_or_args)
-- yazi 2024-11-29 changed the way arguments are passed to the plugin
-- entry point. They were moved inside {args = {...}}. If the user is using
-- a version before this change, they can use the old implementation.
-- https://github.com/sxyazi/yazi/pull/1966
local args = job_or_args.args or job_or_args
local command = Command("starship")
:arg("prompt")
:stdin(Command.INHERIT)
:cwd(args[1])
:env("STARSHIP_SHELL", "")
-- Point to custom starship config
local config_file = get_config_file()
if config_file then
command = command:env("STARSHIP_CONFIG", config_file)
end
local output = command:output()
if output then
save(args[1], output.stdout:gsub("^%s+", ""))
end
end,
}