feat: initial commit

This commit is contained in:
johannes committed 2026-07-26 11:42:17 +02:00
commit b802ff49ab
454 files changed
+52429

No files matched your search

@@ -0,0 +1,21 @@
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.
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Catppuccin
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.
@@ -0,0 +1,36 @@
<div align="center">
<img src="https://github.com/sxyazi/yazi/blob/main/assets/logo.png?raw=true" alt="Yazi logo" width="20%">
</div>
<h3 align="center">
Catppuccin Latte Flavor for <a href="https://github.com/sxyazi/yazi">Yazi</a>
</h3>
## 👀 Preview
<img src="preview.png" width="600" />
## 🎨 Installation
```sh
ya pkg add yazi-rs/flavors:catppuccin-latte
```
## ⚙️ Usage
Set the content of your `theme.toml` to enable it as your _light_ flavor:
```toml
[flavor]
light = "catppuccin-latte"
```
Make sure your `theme.toml` doesn't contain anything other than `[flavor]`, unless you want to override certain styles of this flavor.
See the [Yazi flavor documentation](https://yazi-rs.github.io/docs/flavors/overview) for more details.
## 📜 License
The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed.
Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details.
@@ -0,0 +1,215 @@
# vim:fileencoding=utf-8:foldmethod=marker
# : Manager {{{
[mgr]
cwd = { fg = "#179299" }
# Find
find_keyword = { fg = "#df8e1d", bold = true, italic = true, underline = true }
find_position = { fg = "#ea76cb", bg = "reset", bold = true, italic = true }
# Marker
marker_copied = { fg = "#40a02b", bg = "#40a02b" }
marker_cut = { fg = "#d20f39", bg = "#d20f39" }
marker_marked = { fg = "#179299", bg = "#179299" }
marker_selected = { fg = "#df8e1d", bg = "#df8e1d" }
# Count
count_copied = { fg = "#eff1f5", bg = "#40a02b" }
count_cut = { fg = "#eff1f5", bg = "#d20f39" }
count_selected = { fg = "#eff1f5", bg = "#df8e1d" }
# Border
border_symbol = "│"
border_style = { fg = "#8c8fa1" }
# : }}}
# : Tabs {{{
[tabs]
active = { fg = "#eff1f5", bg = "#1e66f5", bold = true }
inactive = { fg = "#1e66f5", bg = "#ccd0da" }
# : }}}
# : Mode {{{
[mode]
normal_main = { fg = "#eff1f5", bg = "#1e66f5", bold = true }
normal_alt = { fg = "#1e66f5", bg = "#ccd0da" }
# Select mode
select_main = { fg = "#eff1f5", bg = "#179299", bold = true }
select_alt = { fg = "#179299", bg = "#ccd0da" }
# Unset mode
unset_main = { fg = "#eff1f5", bg = "#dd7878", bold = true }
unset_alt = { fg = "#dd7878", bg = "#ccd0da" }
# : }}}
# : Status bar {{{
[status]
# Permissions
perm_sep = { fg = "#8c8fa1" }
perm_type = { fg = "#1e66f5" }
perm_read = { fg = "#df8e1d" }
perm_write = { fg = "#d20f39" }
perm_exec = { fg = "#40a02b" }
# Progress
progress_label = { fg = "#ffffff", bold = true }
progress_normal = { fg = "#40a02b", bg = "#bcc0cc" }
progress_error = { fg = "#df8e1d", bg = "#d20f39" }
# : }}}
# : Pick {{{
[pick]
border = { fg = "#1e66f5" }
active = { fg = "#ea76cb", bold = true }
inactive = {}
# : }}}
# : Input {{{
[input]
border = { fg = "#1e66f5" }
title = {}
value = {}
selected = { reversed = true }
# : }}}
# : Completion {{{
[cmp]
border = { fg = "#1e66f5" }
# : }}}
# : Tasks {{{
[tasks]
border = { fg = "#1e66f5" }
title = {}
hovered = { fg = "#ea76cb", bold = true }
# : }}}
# : Which {{{
[which]
mask = { bg = "#ccd0da" }
cand = { fg = "#179299" }
rest = { fg = "#7c7f93" }
desc = { fg = "#ea76cb" }
separator = "  "
separator_style = { fg = "#acb0be" }
# : }}}
# : Help {{{
[help]
on = { fg = "#179299" }
run = { fg = "#ea76cb" }
hovered = { reversed = true, bold = true }
footer = { fg = "#ccd0da", bg = "#4c4f69" }
# : }}}
# : Spotter {{{
[spot]
border = { fg = "#1e66f5" }
title = { fg = "#1e66f5" }
tbl_col = { fg = "#179299" }
tbl_cell = { fg = "#ea76cb", bg = "#bcc0cc" }
# : }}}
# : Notification {{{
[notify]
title_info = { fg = "#40a02b" }
title_warn = { fg = "#df8e1d" }
title_error = { fg = "#d20f39" }
# : }}}
# : File-specific styles {{{
[filetype]
rules = [
# Image
{ mime = "image/*", fg = "#179299" },
# Media
{ mime = "{audio,video}/*", fg = "#df8e1d" },
# Archive
{ mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", fg = "#ea76cb" },
# Document
{ mime = "application/{pdf,doc,rtf}", fg = "#40a02b" },
# Virtual file system
{ mime = "vfs/{absent,stale}", fg = "#7c7f93" },
# Fallback
{ url = "*", fg = "#4c4f69" },
{ url = "*/", fg = "#1e66f5" },
]
# : }}}
[icon]
dirs = [
{ name = ".config", text = "", fg = "#ea76cb" },
{ name = ".git", text = "", fg = "#179299" },
{ name = ".github", text = "", fg = "#1e66f5" },
{ name = ".npm", text = "", fg = "#1e66f5" },
{ name = "Desktop", text = "", fg = "#179299" },
{ name = "Development", text = "", fg = "#179299" },
{ name = "Documents", text = "", fg = "#179299" },
{ name = "Downloads", text = "", fg = "#179299" },
{ name = "Library", text = "", fg = "#179299" },
{ name = "Movies", text = "", fg = "#179299" },
{ name = "Music", text = "", fg = "#179299" },
{ name = "Pictures", text = "", fg = "#179299" },
{ name = "Public", text = "", fg = "#179299" },
{ name = "Videos", text = "", fg = "#179299" },
]
conds = [
# Special files
{ if = "orphan", text = "", fg = "#4c4f69" },
{ if = "link", text = "", fg = "#8c8fa1" },
{ if = "block", text = "", fg = "#dd7878" },
{ if = "char", text = "", fg = "#dd7878" },
{ if = "fifo", text = "", fg = "#dd7878" },
{ if = "sock", text = "", fg = "#dd7878" },
{ if = "sticky", text = "", fg = "#dd7878" },
{ if = "dummy", text = "", fg = "#d20f39" },
# Fallback
{ if = "dir & hovered", text = "", fg = "#1e66f5" },
{ if = "dir", text = "", fg = "#1e66f5" },
{ if = "exec", text = "", fg = "#40a02b" },
{ if = "!dir", text = "", fg = "#4c4f69" },
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 718 KiB

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,21 @@
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.
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 Catppuccin
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.
@@ -0,0 +1,36 @@
<div align="center">
<img src="https://github.com/sxyazi/yazi/blob/main/assets/logo.png?raw=true" alt="Yazi logo" width="20%">
</div>
<h3 align="center">
Catppuccin Mocha Flavor for <a href="https://github.com/sxyazi/yazi">Yazi</a>
</h3>
## 👀 Preview
<img src="preview.png" width="600" />
## 🎨 Installation
```sh
ya pkg add yazi-rs/flavors:catppuccin-mocha
```
## ⚙️ Usage
Set the content of your `theme.toml` to enable it as your _dark_ flavor:
```toml
[flavor]
dark = "catppuccin-mocha"
```
Make sure your `theme.toml` doesn't contain anything other than `[flavor]`, unless you want to override certain styles of this flavor.
See the [Yazi flavor documentation](https://yazi-rs.github.io/docs/flavors/overview) for more details.
## 📜 License
The flavor is MIT-licensed, and the included tmTheme is also MIT-licensed.
Check the [LICENSE](LICENSE) and [LICENSE-tmtheme](LICENSE-tmtheme) file for more details.
@@ -0,0 +1,215 @@
# vim:fileencoding=utf-8:foldmethod=marker
# : Manager {{{
[mgr]
cwd = { fg = "#94e2d5" }
# Find
find_keyword = { fg = "#f9e2af", bold = true, italic = true, underline = true }
find_position = { fg = "#f5c2e7", bg = "reset", bold = true, italic = true }
# Marker
marker_copied = { fg = "#a6e3a1", bg = "#a6e3a1" }
marker_cut = { fg = "#f38ba8", bg = "#f38ba8" }
marker_marked = { fg = "#94e2d5", bg = "#94e2d5" }
marker_selected = { fg = "#f9e2af", bg = "#f9e2af" }
# Count
count_copied = { fg = "#1e1e2e", bg = "#a6e3a1" }
count_cut = { fg = "#1e1e2e", bg = "#f38ba8" }
count_selected = { fg = "#1e1e2e", bg = "#f9e2af" }
# Border
border_symbol = "│"
border_style = { fg = "#7f849c" }
# : }}}
# : Tabs {{{
[tabs]
active = { fg = "#1e1e2e", bg = "#89b4fa", bold = true }
inactive = { fg = "#89b4fa", bg = "#313244" }
# : }}}
# : Mode {{{
[mode]
normal_main = { fg = "#1e1e2e", bg = "#89b4fa", bold = true }
normal_alt = { fg = "#89b4fa", bg = "#313244" }
# Select mode
select_main = { fg = "#1e1e2e", bg = "#94e2d5", bold = true }
select_alt = { fg = "#94e2d5", bg = "#313244" }
# Unset mode
unset_main = { fg = "#1e1e2e", bg = "#f2cdcd", bold = true }
unset_alt = { fg = "#f2cdcd", bg = "#313244" }
# : }}}
# : Status bar {{{
[status]
# Permissions
perm_sep = { fg = "#7f849c" }
perm_type = { fg = "#89b4fa" }
perm_read = { fg = "#f9e2af" }
perm_write = { fg = "#f38ba8" }
perm_exec = { fg = "#a6e3a1" }
# Progress
progress_label = { fg = "#ffffff", bold = true }
progress_normal = { fg = "#a6e3a1", bg = "#45475a" }
progress_error = { fg = "#f9e2af", bg = "#f38ba8" }
# : }}}
# : Pick {{{
[pick]
border = { fg = "#89b4fa" }
active = { fg = "#f5c2e7", bold = true }
inactive = {}
# : }}}
# : Input {{{
[input]
border = { fg = "#89b4fa" }
title = {}
value = {}
selected = { reversed = true }
# : }}}
# : Completion {{{
[cmp]
border = { fg = "#89b4fa" }
# : }}}
# : Tasks {{{
[tasks]
border = { fg = "#89b4fa" }
title = {}
hovered = { fg = "#f5c2e7", bold = true }
# : }}}
# : Which {{{
[which]
mask = { bg = "#313244" }
cand = { fg = "#94e2d5" }
rest = { fg = "#9399b2" }
desc = { fg = "#f5c2e7" }
separator = "  "
separator_style = { fg = "#585b70" }
# : }}}
# : Help {{{
[help]
on = { fg = "#94e2d5" }
run = { fg = "#f5c2e7" }
hovered = { reversed = true, bold = true }
footer = { fg = "#313244", bg = "#cdd6f4" }
# : }}}
# : Spotter {{{
[spot]
border = { fg = "#89b4fa" }
title = { fg = "#89b4fa" }
tbl_col = { fg = "#94e2d5" }
tbl_cell = { fg = "#f5c2e7", bg = "#45475a" }
# : }}}
# : Notification {{{
[notify]
title_info = { fg = "#a6e3a1" }
title_warn = { fg = "#f9e2af" }
title_error = { fg = "#f38ba8" }
# : }}}
# : File-specific styles {{{
[filetype]
rules = [
# Image
{ mime = "image/*", fg = "#94e2d5" },
# Media
{ mime = "{audio,video}/*", fg = "#f9e2af" },
# Archive
{ mime = "application/{zip,rar,7z*,tar,gzip,xz,zstd,bzip*,lzma,compress,archive,cpio,arj,xar,ms-cab*}", fg = "#f5c2e7" },
# Document
{ mime = "application/{pdf,doc,rtf}", fg = "#a6e3a1" },
# Virtual file system
{ mime = "vfs/{absent,stale}", fg = "#9399b2" },
# Fallback
{ url = "*", fg = "#cdd6f4" },
{ url = "*/", fg = "#89b4fa" },
]
# : }}}
[icon]
dirs = [
{ name = ".config", text = "", fg = "#f5c2e7" },
{ name = ".git", text = "", fg = "#94e2d5" },
{ name = ".github", text = "", fg = "#89b4fa" },
{ name = ".npm", text = "", fg = "#89b4fa" },
{ name = "Desktop", text = "", fg = "#94e2d5" },
{ name = "Development", text = "", fg = "#94e2d5" },
{ name = "Documents", text = "", fg = "#94e2d5" },
{ name = "Downloads", text = "", fg = "#94e2d5" },
{ name = "Library", text = "", fg = "#94e2d5" },
{ name = "Movies", text = "", fg = "#94e2d5" },
{ name = "Music", text = "", fg = "#94e2d5" },
{ name = "Pictures", text = "", fg = "#94e2d5" },
{ name = "Public", text = "", fg = "#94e2d5" },
{ name = "Videos", text = "", fg = "#94e2d5" },
]
conds = [
# Special files
{ if = "orphan", text = "", fg = "#cdd6f4" },
{ if = "link", text = "", fg = "#7f849c" },
{ if = "block", text = "", fg = "#f2cdcd" },
{ if = "char", text = "", fg = "#f2cdcd" },
{ if = "fifo", text = "", fg = "#f2cdcd" },
{ if = "sock", text = "", fg = "#f2cdcd" },
{ if = "sticky", text = "", fg = "#f2cdcd" },
{ if = "dummy", text = "", fg = "#f38ba8" },
# Fallback
{ if = "dir & hovered", text = "", fg = "#89b4fa" },
{ if = "dir", text = "", fg = "#89b4fa" },
{ if = "exec", text = "", fg = "#a6e3a1" },
{ if = "!dir", text = "", fg = "#cdd6f4" },
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 660 KiB

File diff suppressed because it is too large. Load diff
+3
View File
@@ -0,0 +1,3 @@
require("sidebar-status"):setup()
require("git"):setup()
require("auto-layout"):setup()
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 Joe Schmitt
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.
@@ -0,0 +1,24 @@
# auto-layout.yazi
This plugin for the [yazi file explorer](https://yazi-rs.github.io) will automatically change the number of columns to show in yazi based on the available width. This is especially useful if you use a terminal layout that might have yazi run in a sidebar (where 1 column is all that's required) but then sometimes zoom into it and you want it to update to use the full 3 column layout.
## Installation
```sh
$ ya pack -a josephschmitt/auto-layout
```
## Usage
```lua
-- In your yazi config's init.lua
require("auto-layout")
```
If you want to customize the breakpoints where the column shifts happen:
```lua
require("auto-layout").setup({
breakpoint_large = 110, -- new large window threshold, defaults to 100
breakpoint_medium = 60, -- new medium window threshold, defaults to 50
})
```
@@ -0,0 +1,180 @@
-- Auto-Layout Yazi Plugin
-- Automatically adjusts the number of Yazi panes based on terminal width.
-- Attempts to use Yazi's configured ratios via `rt.mgr.ratio`.
-- Falls back to fixed internal ratios if `rt.mgr.ratio` is unavailable.
--
-- Usage in init.lua:
-- require("auto-layout").setup({
-- breakpoint_large = 110, -- Width threshold for 3 panes (default: 100)
-- breakpoint_medium = 60, -- Width threshold for 2 panes (default: 50)
-- })
-- If setup is not called, default breakpoints are used.
-- --- Debug Flag ---
-- Set to true to enable logging to the file specified below.
local DEBUG_MODE = false
-- --- Logging Setup ---
local log_file_path = "/tmp/yazi-autolayout-debug.log"
local log_enabled = DEBUG_MODE
local function write_log(level, message) if not log_enabled then return end local success, file_or_err = pcall(io.open, log_file_path, "a") if success and file_or_err then local file = file_or_err local timestamp = os.date("%Y-%m-%d %H:%M:%S") local write_success, write_err = pcall(function() file:write(string.format("[%s] [%s] %s\n", timestamp, level, message)) file:flush() file:close() end) if not write_success then io.stderr:write(string.format("[auto-layout] LOG WRITE ERROR: %s\n", tostring(write_err))) end else io.stderr:write(string.format("[auto-layout] LOG FILE ERROR: Could not open %s - %s\n", log_file_path, tostring(file_or_err))) end end
local function log_info(message) write_log("INFO", message) end
local function log_warn(message) write_log("WARN", message) end
local function log_error(message) write_log("ERROR", message) end
if DEBUG_MODE then local success, file_or_err = pcall(io.open, log_file_path, "w"); if success and file_or_err then file_or_err:close() end end
-- --- End Logging Setup ---
-- --- Configuration ---
local plugin_config = {
breakpoint_large = 100,
breakpoint_medium = 50,
}
-- Define fallback ratios in case Yazi's runtime ratios are unavailable.
local fallback_ratios = { parent = 2, current = 3, preview = 4, all = 9 }
-- --- End Configuration ---
-- --- Plugin Module ---
local M = {}
local original_layout = nil
local layout_overridden = false
-- Get layout ratios, trying the modern 'rt.mgr.ratio' first.
local function get_layout_ratios()
local using_fallback = true -- Assume fallback needed initially
local ratios = fallback_ratios -- Default to fallback
log_info("Attempting to get ratios from rt.mgr.ratio...")
-- Check the modern Yazi runtime object path
if rt and rt.mgr and rt.mgr.ratio and
rt.mgr.ratio.parent and rt.mgr.ratio.current and
rt.mgr.ratio.preview and rt.mgr.ratio.all then
log_info(" -> Success: Found ratios in rt.mgr.ratio.")
ratios = rt.mgr.ratio
using_fallback = false
else
-- Log the specific reason for failure if possible
if not rt then log_warn(" -> Failed: 'rt' object not available.")
elseif not rt.mgr then log_warn(" -> Failed: 'rt.mgr' not available.")
elseif not rt.mgr.ratio then log_warn(" -> Failed: 'rt.mgr.ratio' not available.")
else log_warn(" -> Failed: One or more required ratios (parent, current, preview, all) missing in rt.mgr.ratio.") end
log_warn(" -> Using fallback ratios.")
end
return ratios, using_fallback
end
-- The layout override function
local function auto_layout_override(self)
log_info("--- Tab:layout Start ---")
if not self._area or not self._area.w then
log_error("ERROR - self._area or self._area.w is nil!")
if original_layout then original_layout(self) end
return
end
if not ui or not ui.Layout or not ui.Constraint then
log_error("ERROR - 'ui' object or components not available!")
if original_layout then original_layout(self) end
return
end
local w = self._area.w
-- Get ratios using the function that tries 'rt.mgr.ratio' first
local ratios, using_fallback = get_layout_ratios()
log_info(string.format("Width=%d, Ratios: p=%d, c=%d, pv=%d, all=%d%s",
w, ratios.parent, ratios.current, ratios.preview, ratios.all,
using_fallback and " (FALLBACK)" or " (FROM rt.mgr.ratio)"))
local success, result = pcall(function()
local constraints = nil
local layout_type = ""
if w > plugin_config.breakpoint_large then
layout_type = "3-column"
constraints = {
ui.Constraint.Ratio(ratios.parent, ratios.all),
ui.Constraint.Ratio(ratios.current, ratios.all),
ui.Constraint.Ratio(ratios.preview, ratios.all),
}
elseif w > plugin_config.breakpoint_medium then
layout_type = "2-column"
constraints = {
ui.Constraint.Ratio(0, ratios.all),
ui.Constraint.Ratio(ratios.current + ratios.parent, ratios.all),
ui.Constraint.Ratio(ratios.preview + ratios.parent, ratios.all),
}
else
layout_type = "1-column"
constraints = {
ui.Constraint.Ratio(0, ratios.all),
ui.Constraint.Ratio(ratios.all, ratios.all),
ui.Constraint.Ratio(0, ratios.all),
}
end
log_info(string.format("Applying %s layout.", layout_type))
self._chunks = ui.Layout() :direction(ui.Layout.HORIZONTAL) :constraints(constraints) :split(self._area)
if not self._chunks then error("Layout split returned nil chunks") end
end)
if not success or not self._chunks then
log_error(string.format("ERROR - Layout failed (success=%s): %s. Falling back.", tostring(success), tostring(result or "chunks nil")))
if original_layout then original_layout(self) end
else
log_info("Layout split successful.")
end
log_info("--- Tab:layout End ---")
end
-- Setup function
function M.setup(user_config)
if DEBUG_MODE and not layout_overridden then
print(string.format("[auto-layout] DEBUG MODE ENABLED. Logging to: %s", log_file_path))
end
log_info("--- Plugin Setup Start ---")
if type(user_config) == "table" then
log_info("Applying user config:")
for k, v in pairs(user_config) do
if plugin_config[k] ~= nil then
log_info(string.format(" Setting plugin_config[%s] = %s", k, tostring(v)))
plugin_config[k] = v
else
log_warn(string.format("WARN - Ignoring unknown config key: %s", k))
end
end
else
log_info("No user config provided or invalid type.")
end
log_info(string.format("Final plugin config - large: %d, medium: %d", plugin_config.breakpoint_large, plugin_config.breakpoint_medium))
if layout_overridden then
log_warn("WARN - Tab:layout already overridden. Skipping.")
return
end
log_info("Attempting to override Tab:layout...")
if not Tab then
log_error("ERROR - Cannot override layout: Global 'Tab' is not available!")
return
end
if not original_layout then
log_info("Storing original Tab.layout function.")
original_layout = Tab.layout
if not original_layout then
log_warn("WARN - Original Tab.layout is nil! Fallback may not work.")
original_layout = function() log_error("ERROR - Executing dummy original_layout (original was nil).") end
end
end
log_info("Assigning auto_layout_override to Tab.layout.")
Tab.layout = auto_layout_override
layout_overridden = true
log_info("Tab:layout override complete.")
log_info("--- Plugin Setup End ---")
end
return M
+21
View File
@@ -0,0 +1,21 @@
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.
+78
View File
@@ -0,0 +1,78 @@
# 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
## 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:
- `th.git.modified`
- `th.git.added`
- `th.git.untracked`
- `th.git.ignored`
- `th.git.deleted`
- `th.git.updated`
For example:
```lua
-- ~/.config/yazi/init.lua
th.git = th.git or {}
th.git.modified = ui.Style():fg("blue")
th.git.deleted = ui.Style():fg("red"):bold()
```
You can also customize the text of the status sign with:
- `th.git.modified_sign`
- `th.git.added_sign`
- `th.git.untracked_sign`
- `th.git.ignored_sign`
- `th.git.deleted_sign`
- `th.git.updated_sign`
For example:
```lua
-- ~/.config/yazi/init.lua
th.git = th.git or {}
th.git.modified_sign = "M"
th.git.deleted_sign = "D"
```
## License
This plugin is MIT-licensed. For more information check the [LICENSE](LICENSE) file.
+228
View File
@@ -0,0 +1,228 @@
--- @since 25.4.4
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`
local CODES = {
excluded = 100, -- ignored directory
ignored = 6, -- ignored file
untracked = 5,
modified = 4,
added = 3,
deleted = 2,
updated = 1,
unknown = 0,
}
local PATTERNS = {
{ "!$", CODES.ignored },
{ "?$", CODES.untracked },
{ "[MT]", CODES.modified },
{ "[AC]", CODES.added },
{ "D", CODES.deleted },
{ "U", CODES.updated },
{ "[AD][AD]", CODES.updated },
}
local function match(line)
local signs = line:sub(1, 2)
for _, p in ipairs(PATTERNS) do
local path, pattern, code = nil, p[1], p[2]
if signs:find(pattern) then
path = line:sub(4, 4) == '"' and line:sub(5, -2) or line:sub(4)
path = WINDOWS and path:gsub("/", "\\") or path
end
if not path then
elseif path:find("[/\\]$") then
-- Mark the ignored directory as `excluded`, so we can process it further within `propagate_down`
return code == CODES.ignored and CODES.excluded or code, path:sub(1, -2)
else
return code, 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 path, code in pairs(changed) do
if code ~= CODES.ignored then
local url = Url(path).parent
while url and url ~= empty do
local s = tostring(url)
new[s] = (new[s] or CODES.unknown) > code and new[s] or code
url = url.parent
end
end
end
return new
end
local function propagate_down(excluded, cwd, repo)
local new, rel = {}, cwd:strip_prefix(repo)
for _, path in ipairs(excluded) do
if rel:starts_with(path) then
-- If `cwd` is a subdirectory of an excluded directory, also mark it as `excluded`
new[tostring(cwd)] = CODES.excluded
elseif cwd == repo:join(path).parent then
-- If `path` is a direct subdirectory of `cwd`, mark it as `ignored`
new[path] = CODES.ignored
else
-- Skipping, we only care about `cwd` itself and its direct subdirectories for maximum performance
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 path, code in pairs(changed) do
if code == CODES.unknown then
st.repos[repo][path] = nil
elseif code == CODES.excluded then
-- Mark the directory with a special value `excluded` so that it can be distinguished during UI rendering
st.dirs[path] = CODES.excluded
else
st.repos[repo][path] = code
end
end
ya.render()
end)
local remove = ya.sync(function(st, cwd)
local repo = st.dirs[cwd]
if not repo then
return
end
ya.render()
st.dirs[cwd] = nil
if not st.repos[repo] then
return
end
for _, r in pairs(st.dirs) do
if r == repo then
return
end
end
st.repos[repo] = nil
end)
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
opts = opts or {}
opts.order = opts.order or 1500
local t = th.git or {}
local styles = {
[CODES.ignored] = t.ignored and ui.Style(t.ignored) or ui.Style():fg("darkgray"),
[CODES.untracked] = t.untracked and ui.Style(t.untracked) or ui.Style():fg("magenta"),
[CODES.modified] = t.modified and ui.Style(t.modified) or ui.Style():fg("yellow"),
[CODES.added] = t.added and ui.Style(t.added) or ui.Style():fg("green"),
[CODES.deleted] = t.deleted and ui.Style(t.deleted) or ui.Style():fg("red"),
[CODES.updated] = t.updated and ui.Style(t.updated) or ui.Style():fg("yellow"),
}
local signs = {
[CODES.ignored] = t.ignored_sign or "",
[CODES.untracked] = t.untracked_sign or "?",
[CODES.modified] = t.modified_sign or "",
[CODES.added] = t.added_sign or "",
[CODES.deleted] = t.deleted_sign or "",
[CODES.updated] = t.updated_sign or "",
}
Linemode:children_add(function(self)
local url = self._file.url
local repo = st.dirs[tostring(url.base)]
local code
if repo then
code = repo == CODES.excluded and CODES.ignored or st.repos[repo][tostring(url):sub(#repo + 2)]
end
if not code or signs[code] == "" then
return ""
elseif self._file.is_hovered then
return ui.Line { " ", signs[code] }
else
return ui.Line { " ", ui.Span(signs[code]):style(styles[code]) }
end
end, opts.order)
end
local function fetch(_, job)
local cwd = job.files[1].url.base
local repo = root(cwd)
if not repo then
remove(tostring(cwd))
return true
end
local paths = {}
for _, file in ipairs(job.files) do
paths[#paths + 1] = tostring(file.url)
end
-- stylua: ignore
local output, err = Command("git")
:cwd(tostring(cwd))
:arg({ "--no-optional-locks", "-c", "core.quotePath=", "status", "--porcelain", "-unormal", "--no-renames", "--ignored=matching" })
:arg(paths)
:stdout(Command.PIPED)
:output()
if not output then
return true, Err("Cannot spawn `git` command, error: %s", err)
end
local changed, excluded = {}, {}
for line in output.stdout:gmatch("[^\r\n]+") do
local code, path = match(line)
if code == CODES.excluded then
excluded[#excluded + 1] = path
else
changed[path] = code
end
end
if job.files[1].cha.is_dir then
ya.dict_merge(changed, bubble_up(changed))
end
ya.dict_merge(changed, propagate_down(excluded, cwd, Url(repo)))
-- Reset the status of any files that don't appear in the output of `git status` to `unknown`,
-- so that cleaning up outdated statuses from `st.repos`
for _, path in ipairs(paths) do
local s = path:sub(#repo + 2)
changed[s] = changed[s] or CODES.unknown
end
add(tostring(cwd), repo, changed)
return false
end
return { setup = setup, fetch = fetch }
@@ -0,0 +1,14 @@
return {
setup = function()
-- Status:children_remove(1, Status.LEFT) -- MODE
-- Status:children_remove(2, Status.LEFT) -- size
Status:children_remove(3, Status.LEFT) -- Desktop
-- Status:children_remove(4, Status.RIGHT) -- OWNERSHIP
-- Status:children_add(function()
-- return ui.Span("Yazelix"):fg("yellow"):bold() -- yazelix string in Bold and yellow
-- end, 4, Status.RIGHT)
-- Status:children_remove(5, Status.RIGHT) -- percentage
-- Status:children_remove(6, Status.RIGHT) -- file counter
end,
}
+7
View File
@@ -0,0 +1,7 @@
[mgr]
show_hidden = true
show_symlink = true
[preview]
wrap = "yes"