some terminal stuff
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:git"
|
||||
rev = "56971d0"
|
||||
hash = "36a484acf6a0a0219c543ccb4cee218f"
|
||||
rev = "88990a6"
|
||||
hash = "270915fa8282a19908449530ff66f7e2"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:smart-enter"
|
||||
rev = "56971d0"
|
||||
rev = "88990a6"
|
||||
hash = "56fdabc96fc1f4d53c96eb884b02a5be"
|
||||
|
||||
[[plugin.deps]]
|
||||
@@ -15,13 +15,13 @@ hash = "699fe07e0d2d1b4af8dafb84168eeb04"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "KKV9/compress"
|
||||
rev = "e6007f7"
|
||||
hash = "e0b1051849756dd72fca874c320259a"
|
||||
rev = "cb6e8ec"
|
||||
hash = "424ada4807b20ccd4fc85d1d7c26d1e4"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "llanosrocas/yaziline"
|
||||
rev = "6266926"
|
||||
hash = "9917ab5cb9bdbab7ca7f2501f84f0f11"
|
||||
rev = "d9cc2cb"
|
||||
hash = "b6073aadf2f9a1d5389a6d389f33f69c"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "Rolv-Apneseth/starship"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,10 @@ ya pkg add yazi-rs/plugins:git
|
||||
Add the following to your `~/.config/yazi/init.lua`:
|
||||
|
||||
```lua
|
||||
require("git"):setup()
|
||||
require("git"):setup {
|
||||
-- Order of status signs showing in the linemode
|
||||
order = 1500,
|
||||
}
|
||||
```
|
||||
|
||||
And register it as fetchers in your `~/.config/yazi/yazi.toml`:
|
||||
@@ -39,12 +42,14 @@ run = "git"
|
||||
|
||||
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`
|
||||
- `th.git.unknown` - status cannot/not yet determined
|
||||
- `th.git.modified` - modified file
|
||||
- `th.git.added` - added file
|
||||
- `th.git.untracked` - untracked file
|
||||
- `th.git.ignored` - ignored file
|
||||
- `th.git.deleted` - deleted file
|
||||
- `th.git.updated` - updated file
|
||||
- `th.git.clean` - clean file
|
||||
|
||||
For example:
|
||||
|
||||
@@ -57,20 +62,24 @@ 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`
|
||||
- `th.git.unknown_sign` - status cannot/not yet determined
|
||||
- `th.git.modified_sign` - modified file
|
||||
- `th.git.added_sign` - added file
|
||||
- `th.git.untracked_sign` - untracked file
|
||||
- `th.git.ignored_sign` - ignored file
|
||||
- `th.git.deleted_sign` - deleted file
|
||||
- `th.git.updated_sign` - updated file
|
||||
- `th.git.clean_sign` - clean file
|
||||
|
||||
For example:
|
||||
|
||||
```lua
|
||||
-- ~/.config/yazi/init.lua
|
||||
th.git = th.git or {}
|
||||
th.git.unknown_sign = " "
|
||||
th.git.modified_sign = "M"
|
||||
th.git.deleted_sign = "D"
|
||||
th.git.clean_sign = "✔"
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
@@ -7,14 +7,15 @@ local WINDOWS = ya.target_family() == "windows"
|
||||
-- see `bubble_up`
|
||||
---@enum CODES
|
||||
local CODES = {
|
||||
excluded = 100, -- ignored directory
|
||||
unknown = 100, -- status cannot/not yet determined
|
||||
excluded = 99, -- ignored directory
|
||||
ignored = 6, -- ignored file
|
||||
untracked = 5,
|
||||
modified = 4,
|
||||
added = 3,
|
||||
deleted = 2,
|
||||
updated = 1,
|
||||
unknown = 0,
|
||||
clean = 0,
|
||||
}
|
||||
|
||||
local PATTERNS = {
|
||||
@@ -79,7 +80,7 @@ local function bubble_up(changed)
|
||||
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
|
||||
new[s] = (new[s] or CODES.clean) > code and new[s] or code
|
||||
url = url.parent
|
||||
end
|
||||
end
|
||||
@@ -116,7 +117,7 @@ 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
|
||||
if code == CODES.clean 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
|
||||
@@ -162,20 +163,24 @@ local function setup(st, opts)
|
||||
|
||||
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"),
|
||||
[CODES.unknown] = t.unknown or ui.Style(),
|
||||
[CODES.ignored] = t.ignored or ui.Style():fg("darkgray"),
|
||||
[CODES.untracked] = t.untracked or ui.Style():fg("magenta"),
|
||||
[CODES.modified] = t.modified or ui.Style():fg("yellow"),
|
||||
[CODES.added] = t.added or ui.Style():fg("green"),
|
||||
[CODES.deleted] = t.deleted or ui.Style():fg("red"),
|
||||
[CODES.updated] = t.updated or ui.Style():fg("yellow"),
|
||||
[CODES.clean] = t.clean or ui.Style(),
|
||||
}
|
||||
local signs = {
|
||||
[CODES.unknown] = t.unknown_sign or "",
|
||||
[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 " ",
|
||||
[CODES.clean] = t.clean_sign or "",
|
||||
}
|
||||
|
||||
Linemode:children_add(function(self)
|
||||
@@ -185,12 +190,12 @@ local function setup(st, opts)
|
||||
|
||||
local url = self._file.url
|
||||
local repo = st.dirs[tostring(url.base or url.parent)]
|
||||
local code
|
||||
local code = CODES.unknown
|
||||
if repo then
|
||||
code = repo == CODES.excluded and CODES.ignored or st.repos[repo][tostring(url):sub(#repo + 2)]
|
||||
code = repo == CODES.excluded and CODES.ignored or st.repos[repo][tostring(url):sub(#repo + 2)] or CODES.clean
|
||||
end
|
||||
|
||||
if not code or signs[code] == "" then
|
||||
if signs[code] == "" then
|
||||
return ""
|
||||
elseif self._file.is_hovered then
|
||||
return ui.Line { " ", signs[code] }
|
||||
@@ -240,11 +245,11 @@ local function fetch(_, job)
|
||||
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`,
|
||||
-- Reset the status of any files that don't appear in the output of `git status` to `clean`,
|
||||
-- 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
|
||||
changed[s] = changed[s] or CODES.clean
|
||||
end
|
||||
|
||||
add(tostring(cwd), repo, changed)
|
||||
|
||||
@@ -9,7 +9,7 @@ All supported features are listed [here](#features). More presets are available
|
||||
|
||||
## Requirements
|
||||
|
||||
- yazi version >= [917e1f5](https://github.com/sxyazi/yazi/commit/917e1f54a10445f2e25147c4b81a3c77d8233632)
|
||||
- yazi version >= [26.1.22](https://github.com/sxyazi/yazi/releases/tag/v26.1.22).
|
||||
- Font with symbol support. For example [Nerd Fonts](https://www.nerdfonts.com/).
|
||||
|
||||
## Compatibility
|
||||
@@ -24,7 +24,7 @@ This setup allows shipping stable versions on time, while giving early access to
|
||||
|
||||
| yaziline | yazi |
|
||||
| :------------------------------------------------------------------------: | ----------------------------------------------------------------------------------------- |
|
||||
| [v2.5.2](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.2) | [v25.12.29](https://github.com/sxyazi/yazi/releases/tag/v25.12.29) |
|
||||
| [v2.5.2](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.2) | [v26.1.22](https://github.com/sxyazi/yazi/releases/tag/v26.1.22) |
|
||||
| [v2.5.2](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.2) | [2f66561](https://github.com/sxyazi/yazi/commit/2f66561a8251f8788b2b0fd366af90555ecafc86) |
|
||||
| [v2.5.2](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.2) | [6cfa92f](https://github.com/sxyazi/yazi/commit/6cfa92f11205d212155579b5b76d4cbabe723829) |
|
||||
| [v2.5.2](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.2) | [917e1f5](https://github.com/sxyazi/yazi/commit/917e1f54a10445f2e25147c4b81a3c77d8233632) |
|
||||
|
||||
Reference in New Issue
Block a user