yazi: upgrade
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
screenshot-path "~/Pictures/Screenshots/niri_screenshot_%Y-%m-%d_%H-%M-%S.png"
|
screenshot-path "~/Pictures/Screenshots/niri_screenshot_%Y-%m-%d_%H-%M-%S.png"
|
||||||
|
|
||||||
debug {
|
debug {
|
||||||
render-drm-device "/dev/dri/card2"
|
render-drm-device "/dev/dri/card0"
|
||||||
}
|
}
|
||||||
|
|
||||||
// gestures {
|
// gestures {
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
[[plugin.deps]]
|
[[plugin.deps]]
|
||||||
use = "yazi-rs/plugins:git"
|
use = "yazi-rs/plugins:git"
|
||||||
rev = "2301ff8"
|
rev = "398796d"
|
||||||
hash = "27ca02f49fd236b5cc7bf03c243859fe"
|
hash = "73788c7dc5827ef4677c502c3ea8fa19"
|
||||||
|
|
||||||
[[plugin.deps]]
|
[[plugin.deps]]
|
||||||
use = "yazi-rs/plugins:smart-enter"
|
use = "yazi-rs/plugins:smart-enter"
|
||||||
rev = "2301ff8"
|
rev = "398796d"
|
||||||
hash = "56fdabc96fc1f4d53c96eb884b02a5be"
|
hash = "56fdabc96fc1f4d53c96eb884b02a5be"
|
||||||
|
|
||||||
[[plugin.deps]]
|
[[plugin.deps]]
|
||||||
use = "h-hg/yamb"
|
use = "h-hg/yamb"
|
||||||
rev = "22af003"
|
rev = "5f2e22e"
|
||||||
hash = "7cc42012a7c2099f80064d228feb8d44"
|
hash = "699fe07e0d2d1b4af8dafb84168eeb04"
|
||||||
|
|
||||||
[[plugin.deps]]
|
[[plugin.deps]]
|
||||||
use = "KKV9/compress"
|
use = "KKV9/compress"
|
||||||
@@ -20,8 +20,8 @@ hash = "e17c11b605d989568a1d1741ca17c584"
|
|||||||
|
|
||||||
[[plugin.deps]]
|
[[plugin.deps]]
|
||||||
use = "llanosrocas/yaziline"
|
use = "llanosrocas/yaziline"
|
||||||
rev = "e7042a8"
|
rev = "6266926"
|
||||||
hash = "9c2ab18ff5368056904e4ebb61b17571"
|
hash = "9917ab5cb9bdbab7ca7f2501f84f0f11"
|
||||||
|
|
||||||
[flavor]
|
[flavor]
|
||||||
deps = []
|
deps = []
|
||||||
|
|||||||
@@ -22,14 +22,14 @@ And register it as fetchers in your `~/.config/yazi/yazi.toml`:
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[plugin.prepend_fetchers]]
|
[[plugin.prepend_fetchers]]
|
||||||
id = "git"
|
id = "git"
|
||||||
name = "*"
|
url = "*"
|
||||||
run = "git"
|
run = "git"
|
||||||
|
|
||||||
[[plugin.prepend_fetchers]]
|
[[plugin.prepend_fetchers]]
|
||||||
id = "git"
|
id = "git"
|
||||||
name = "*/"
|
url = "*/"
|
||||||
run = "git"
|
run = "git"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Advanced
|
## Advanced
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
--- @since 25.5.31
|
--- @since 25.12.29
|
||||||
|
|
||||||
local WINDOWS = ya.target_family() == "windows"
|
local WINDOWS = ya.target_family() == "windows"
|
||||||
|
|
||||||
@@ -125,12 +125,7 @@ local add = ya.sync(function(st, cwd, repo, changed)
|
|||||||
st.repos[repo][path] = code
|
st.repos[repo][path] = code
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- TODO: remove this
|
ui.render()
|
||||||
if ui.render then
|
|
||||||
ui.render()
|
|
||||||
else
|
|
||||||
ya.render()
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
---@param cwd string
|
---@param cwd string
|
||||||
@@ -142,12 +137,7 @@ local remove = ya.sync(function(st, cwd)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO: remove this
|
ui.render()
|
||||||
if ui.render then
|
|
||||||
ui.render()
|
|
||||||
else
|
|
||||||
ya.render()
|
|
||||||
end
|
|
||||||
st.dirs[cwd] = nil
|
st.dirs[cwd] = nil
|
||||||
if not st.repos[repo] then
|
if not st.repos[repo] then
|
||||||
return
|
return
|
||||||
@@ -189,6 +179,10 @@ local function setup(st, opts)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Linemode:children_add(function(self)
|
Linemode:children_add(function(self)
|
||||||
|
if not self._file.in_current then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
|
|
||||||
local url = self._file.url
|
local url = self._file.url
|
||||||
local repo = st.dirs[tostring(url.base or url.parent)]
|
local repo = st.dirs[tostring(url.base or url.parent)]
|
||||||
local code
|
local code
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---@class State
|
||||||
|
---@field dirs table<string, string|CODES> Mapping between a directory and its corresponding repository
|
||||||
|
---@field repos table<string, Changes> Mapping between a repository and the status of each of its files
|
||||||
|
|
||||||
|
---@class Options
|
||||||
|
---@field order number The order in which the status is displayed
|
||||||
|
---@field renamed boolean Whether to include renamed files in the status (or treat them as modified)
|
||||||
|
|
||||||
|
-- TODO: move this to `types.yazi` once it's get stable
|
||||||
|
---@alias UnstableFetcher fun(self: unknown, job: { files: File[] }): boolean, Error?
|
||||||
|
|
||||||
|
---@alias Changes table<string, CODES>
|
||||||
@@ -10,17 +10,10 @@ A [Yazi](https://github.com/sxyazi/yazi) plugin for bookmark management, support
|
|||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> Yazi >= 0.25.
|
> Yazi >= 25.6.11
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Linux/macOS
|
ya pkg add h-hg/yamb
|
||||||
git clone https://github.com/h-hg/yamb.yazi.git ~/.config/yazi/plugins/yamb.yazi
|
|
||||||
|
|
||||||
# Windows
|
|
||||||
git clone https://github.com/h-hg/yamb.yazi.git $env:APPDATA\yazi\config\plugins\yamb.yazi
|
|
||||||
|
|
||||||
# if you are using Yazi version >= 3.0
|
|
||||||
ya pack -a h-hg/yamb
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@@ -36,7 +29,6 @@ local home_path = ya.target_family() == "windows" and os.getenv("USERPROFILE") o
|
|||||||
if ya.target_family() == "windows" then
|
if ya.target_family() == "windows" then
|
||||||
table.insert(bookmarks, {
|
table.insert(bookmarks, {
|
||||||
tag = "Scoop Local",
|
tag = "Scoop Local",
|
||||||
|
|
||||||
path = (os.getenv("SCOOP") or home_path .. "\\scoop") .. "\\",
|
path = (os.getenv("SCOOP") or home_path .. "\\scoop") .. "\\",
|
||||||
key = "p"
|
key = "p"
|
||||||
})
|
})
|
||||||
@@ -70,43 +62,43 @@ require("yamb"):setup {
|
|||||||
Add this to your `keymap.toml`:
|
Add this to your `keymap.toml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[[manager.prepend_keymap]]
|
[[mgr.prepend_keymap]]
|
||||||
on = [ "u", "a" ]
|
on = [ "u", "a" ]
|
||||||
run = "plugin yamb save"
|
run = "plugin yamb -- save"
|
||||||
desc = "Add bookmark"
|
desc = "Add bookmark"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[mgr.prepend_keymap]]
|
||||||
on = [ "u", "g" ]
|
on = [ "u", "g" ]
|
||||||
run = "plugin yamb jump_by_key"
|
run = "plugin yamb -- jump_by_key"
|
||||||
desc = "Jump bookmark by key"
|
desc = "Jump bookmark by key"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[mgr.prepend_keymap]]
|
||||||
on = [ "u", "G" ]
|
on = [ "u", "G" ]
|
||||||
run = "plugin yamb jump_by_fzf"
|
run = "plugin yamb -- jump_by_fzf"
|
||||||
desc = "Jump bookmark by fzf"
|
desc = "Jump bookmark by fzf"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[mgr.prepend_keymap]]
|
||||||
on = [ "u", "d" ]
|
on = [ "u", "d" ]
|
||||||
run = "plugin yamb delete_by_key"
|
run = "plugin yamb -- delete_by_key"
|
||||||
desc = "Delete bookmark by key"
|
desc = "Delete bookmark by key"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[mgr.prepend_keymap]]
|
||||||
on = [ "u", "D" ]
|
on = [ "u", "D" ]
|
||||||
run = "plugin yamb delete_by_fzf"
|
run = "plugin yamb -- delete_by_fzf"
|
||||||
desc = "Delete bookmark by fzf"
|
desc = "Delete bookmark by fzf"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[mgr.prepend_keymap]]
|
||||||
on = [ "u", "A" ]
|
on = [ "u", "A" ]
|
||||||
run = "plugin yamb delete_all"
|
run = "plugin yamb -- delete_all"
|
||||||
desc = "Delete all bookmarks"
|
desc = "Delete all bookmarks"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[mgr.prepend_keymap]]
|
||||||
on = [ "u", "r" ]
|
on = [ "u", "r" ]
|
||||||
run = "plugin yamb rename_by_key"
|
run = "plugin yamb -- rename_by_key"
|
||||||
desc = "Rename bookmark by key"
|
desc = "Rename bookmark by key"
|
||||||
|
|
||||||
[[manager.prepend_keymap]]
|
[[mgr.prepend_keymap]]
|
||||||
on = [ "u", "R" ]
|
on = [ "u", "R" ]
|
||||||
run = "plugin yamb rename_by_fzf"
|
run = "plugin yamb -- rename_by_fzf"
|
||||||
desc = "Rename bookmark by fzf"
|
desc = "Rename bookmark by fzf"
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,355 +1,367 @@
|
|||||||
|
--- @since 25.6.11
|
||||||
local path_sep = package.config:sub(1, 1)
|
local path_sep = package.config:sub(1, 1)
|
||||||
|
|
||||||
local get_hovered_path = ya.sync(function(state)
|
local get_hovered_path = ya.sync(function(state)
|
||||||
local h = cx.active.current.hovered
|
local h = cx.active.current.hovered
|
||||||
if h then
|
if h then
|
||||||
local path = tostring(h.url)
|
local path = tostring(h.url)
|
||||||
if h.cha.is_dir then
|
if h.cha.is_dir then
|
||||||
return path .. path_sep
|
return path .. path_sep
|
||||||
end
|
end
|
||||||
return path
|
return path
|
||||||
else
|
else
|
||||||
return ''
|
return ""
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local get_state_attr = ya.sync(function(state, attr)
|
local get_state_attr = ya.sync(function(state, attr)
|
||||||
return state[attr]
|
return state[attr]
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local set_state_attr = ya.sync(function(state, attr, value)
|
local set_state_attr = ya.sync(function(state, attr, value)
|
||||||
state[attr] = value
|
state[attr] = value
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local set_bookmarks = ya.sync(function(state, path, value)
|
local set_bookmarks = ya.sync(function(state, path, value)
|
||||||
state.bookmarks[path] = value
|
state.bookmarks[path] = value
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local sort_bookmarks = function(bookmarks, key1, key2, reverse)
|
local sort_bookmarks = function(bookmarks, key1, key2, reverse)
|
||||||
reverse = reverse or false
|
reverse = reverse or false
|
||||||
table.sort(bookmarks, function(x, y)
|
table.sort(bookmarks, function(x, y)
|
||||||
if x[key1] == nil and y[key1] == nil then
|
if x[key1] == nil and y[key1] == nil then
|
||||||
return x[key2] < y[key2]
|
return x[key2] < y[key2]
|
||||||
elseif x[key1] == nil then
|
elseif x[key1] == nil then
|
||||||
return false
|
return false
|
||||||
elseif y[key1] == nil then
|
elseif y[key1] == nil then
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
return x[key1] < y[key1]
|
return x[key1] < y[key1]
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
if reverse then
|
if reverse then
|
||||||
local n = #bookmarks
|
local n = #bookmarks
|
||||||
for i = 1, math.floor(n / 2) do
|
for i = 1, math.floor(n / 2) do
|
||||||
bookmarks[i], bookmarks[n - i + 1] = bookmarks[n - i + 1], bookmarks[i]
|
bookmarks[i], bookmarks[n - i + 1] = bookmarks[n - i + 1], bookmarks[i]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return bookmarks
|
return bookmarks
|
||||||
end
|
end
|
||||||
|
|
||||||
local save_to_file = function(mb_path, bookmarks)
|
local save_to_file = function(mb_path, bookmarks)
|
||||||
local file = io.open(mb_path, "w")
|
local file = io.open(mb_path, "w")
|
||||||
if file == nil then
|
if file == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local array = {}
|
local array = {}
|
||||||
for _, item in pairs(bookmarks) do
|
for _, item in pairs(bookmarks) do
|
||||||
table.insert(array, item)
|
table.insert(array, item)
|
||||||
end
|
end
|
||||||
sort_bookmarks(array, "tag", "key", true)
|
sort_bookmarks(array, "tag", "key", true)
|
||||||
for _, item in ipairs(array) do
|
for _, item in ipairs(array) do
|
||||||
file:write(string.format("%s\t%s\t%s\n", item.tag, item.path, item.key))
|
file:write(string.format("%s\t%s\t%s\n", item.tag, item.path, item.key))
|
||||||
end
|
end
|
||||||
file:close()
|
file:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
local fzf_find = function(cli, mb_path)
|
local fzf_find = function(cli, mb_path)
|
||||||
local permit = ya.hide()
|
local permit = ya.hide()
|
||||||
local cmd = string.format("%s < \"%s\"", cli, mb_path)
|
local cmd = string.format('%s < "%s"', cli, mb_path)
|
||||||
local handle = io.popen(cmd, "r")
|
local handle = io.popen(cmd, "r")
|
||||||
local result = ""
|
local result = ""
|
||||||
if handle then
|
if handle then
|
||||||
-- strip
|
-- strip
|
||||||
result = string.gsub(handle:read("*all") or "", "^%s*(.-)%s*$", "%1")
|
result = string.gsub(handle:read("*all") or "", "^%s*(.-)%s*$", "%1")
|
||||||
handle:close()
|
handle:close()
|
||||||
end
|
end
|
||||||
permit:drop()
|
permit:drop()
|
||||||
local tag, path, key = string.match(result or "", "(.-)\t(.-)\t(.*)")
|
local tag, path, key = string.match(result or "", "(.-)\t(.-)\t(.*)")
|
||||||
return path
|
return path
|
||||||
end
|
end
|
||||||
|
|
||||||
local which_find = function(bookmarks)
|
local which_find = function(bookmarks)
|
||||||
local cands = {}
|
local cands = {}
|
||||||
for path, item in pairs(bookmarks) do
|
for path, item in pairs(bookmarks) do
|
||||||
if #item.tag ~= 0 then
|
if #item.tag ~= 0 then
|
||||||
table.insert(cands, { desc = item.tag, on = item.key, path = item.path })
|
table.insert(cands, { desc = item.tag, on = item.key, path = item.path })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
sort_bookmarks(cands, "on", "desc", false)
|
sort_bookmarks(cands, "on", "desc", false)
|
||||||
if #cands == 0 then
|
if #cands == 0 then
|
||||||
ya.notify {
|
ya.notify({
|
||||||
title = "Bookmarks",
|
title = "Bookmarks",
|
||||||
content = "Empty bookmarks",
|
content = "Empty bookmarks",
|
||||||
timeout = 2,
|
timeout = 2,
|
||||||
level = "info",
|
level = "info",
|
||||||
}
|
})
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
local idx = ya.which { cands = cands }
|
local idx = ya.which({ cands = cands })
|
||||||
if idx == nil then
|
if idx == nil then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
return cands[idx].path
|
return cands[idx].path
|
||||||
end
|
end
|
||||||
|
|
||||||
local action_jump = function(bookmarks, path, jump_notify)
|
local action_jump = function(bookmarks, path, jump_notify)
|
||||||
if path == nil then
|
if path == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local tag = bookmarks[path].tag
|
local tag = bookmarks[path].tag
|
||||||
if string.sub(path, -1) == path_sep then
|
if string.sub(path, -1) == path_sep then
|
||||||
ya.manager_emit("cd", { path })
|
ya.emit("cd", { path, raw = true })
|
||||||
else
|
else
|
||||||
ya.manager_emit("reveal", { path })
|
ya.emit("reveal", { path, no_dummy = true, raw = true })
|
||||||
end
|
end
|
||||||
if jump_notify then
|
if jump_notify then
|
||||||
ya.notify {
|
ya.notify({
|
||||||
title = "Bookmarks",
|
title = "Bookmarks",
|
||||||
content = 'Jump to "' .. tag .. '"',
|
content = 'Jump to "' .. tag .. '"',
|
||||||
timeout = 2,
|
timeout = 2,
|
||||||
level = "info",
|
level = "info",
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local generate_key = function(bookmarks)
|
local generate_key = function(bookmarks)
|
||||||
local keys = get_state_attr("keys")
|
local keys = get_state_attr("keys")
|
||||||
local key2rank = get_state_attr("key2rank")
|
local key2rank = get_state_attr("key2rank")
|
||||||
local mb = {}
|
local mb = {}
|
||||||
for _, item in pairs(bookmarks) do
|
for _, item in pairs(bookmarks) do
|
||||||
if #item.key == 1 then
|
if #item.key == 1 then
|
||||||
table.insert(mb, item.key)
|
table.insert(mb, item.key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if #mb == 0 then
|
if #mb == 0 then
|
||||||
return keys[1]
|
return keys[1]
|
||||||
end
|
end
|
||||||
table.sort(mb, function(a, b)
|
table.sort(mb, function(a, b)
|
||||||
return key2rank[a] < key2rank[b]
|
return key2rank[a] < key2rank[b]
|
||||||
end)
|
end)
|
||||||
local idx = 1
|
local idx = 1
|
||||||
for _, key in ipairs(keys) do
|
for _, key in ipairs(keys) do
|
||||||
if idx > #mb or key2rank[key] < key2rank[mb[idx]] then
|
if idx > #mb or key2rank[key] < key2rank[mb[idx]] then
|
||||||
return key
|
return key
|
||||||
end
|
end
|
||||||
idx = idx + 1
|
idx = idx + 1
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local action_save = function(mb_path, bookmarks, path)
|
local action_save = function(mb_path, bookmarks, path)
|
||||||
if path == nil or #path == 0 then
|
if path == nil or #path == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local path_obj = bookmarks[path]
|
local path_obj = bookmarks[path]
|
||||||
-- check tag
|
-- check tag
|
||||||
local tag = path_obj and path_obj.tag or path:match(".*[\\/]([^\\/]+)[\\/]?$")
|
local tag = path_obj and path_obj.tag or path:match(".*[\\/]([^\\/]+)[\\/]?$")
|
||||||
while true do
|
while true do
|
||||||
local value, event = ya.input({
|
local value, event = ya.input({
|
||||||
title = "Tag (alias name)",
|
title = "Tag (alias name)",
|
||||||
value = tag,
|
value = tag,
|
||||||
position = { "top-center", y = 3, w = 40 },
|
pos = { "top-center", y = 3, w = 40 },
|
||||||
})
|
-- TODO: remove this after next yazi released
|
||||||
if event ~= 1 then
|
position = { "top-center", y = 3, w = 40 },
|
||||||
return
|
})
|
||||||
end
|
if event ~= 1 then
|
||||||
tag = value or ''
|
return
|
||||||
if #tag == 0 then
|
end
|
||||||
ya.notify {
|
tag = value or ""
|
||||||
title = "Bookmarks",
|
if #tag == 0 then
|
||||||
content = "Empty tag",
|
ya.notify({
|
||||||
timeout = 2,
|
title = "Bookmarks",
|
||||||
level = "info",
|
content = "Empty tag",
|
||||||
}
|
timeout = 2,
|
||||||
else
|
level = "info",
|
||||||
-- check the tag
|
})
|
||||||
local tag_obj = nil
|
else
|
||||||
for _, item in pairs(bookmarks) do
|
-- check the tag
|
||||||
if item.tag == tag then
|
local tag_obj = nil
|
||||||
tag_obj = item
|
for _, item in pairs(bookmarks) do
|
||||||
break
|
if item.tag == tag then
|
||||||
end
|
tag_obj = item
|
||||||
end
|
break
|
||||||
if tag_obj == nil or tag_obj.path == path then
|
end
|
||||||
break
|
end
|
||||||
end
|
if tag_obj == nil or tag_obj.path == path then
|
||||||
ya.notify {
|
break
|
||||||
title = "Bookmarks",
|
end
|
||||||
content = "Duplicated tag",
|
ya.notify({
|
||||||
timeout = 2,
|
title = "Bookmarks",
|
||||||
level = "info",
|
content = "Duplicated tag",
|
||||||
}
|
timeout = 2,
|
||||||
end
|
level = "info",
|
||||||
end
|
})
|
||||||
-- check key
|
end
|
||||||
local key = path_obj and path_obj.key or generate_key(bookmarks)
|
end
|
||||||
while true do
|
-- check key
|
||||||
local value, event = ya.input({
|
local key = path_obj and path_obj.key or generate_key(bookmarks)
|
||||||
title = "Key (1 character, optional)",
|
while true do
|
||||||
value = key,
|
local value, event = ya.input({
|
||||||
position = { "top-center", y = 3, w = 40 },
|
title = "Key (1 character, optional)",
|
||||||
})
|
value = key,
|
||||||
if event ~= 1 then
|
pos = { "top-center", y = 3, w = 40 },
|
||||||
return
|
-- TODO: remove this after next yazi released
|
||||||
end
|
position = { "top-center", y = 3, w = 40 },
|
||||||
key = value or ""
|
})
|
||||||
if key == "" then
|
if event ~= 1 then
|
||||||
key = ""
|
return
|
||||||
break
|
end
|
||||||
elseif #key == 1 then
|
key = value or ""
|
||||||
-- check the key
|
if key == "" then
|
||||||
local key_obj = nil
|
key = ""
|
||||||
for _, item in pairs(bookmarks) do
|
break
|
||||||
if item.key == key then
|
elseif #key == 1 then
|
||||||
key_obj = item
|
-- check the key
|
||||||
break
|
local key_obj = nil
|
||||||
end
|
for _, item in pairs(bookmarks) do
|
||||||
end
|
if item.key == key then
|
||||||
if key_obj == nil or key_obj.path == path then
|
key_obj = item
|
||||||
break
|
break
|
||||||
else
|
end
|
||||||
ya.notify {
|
end
|
||||||
title = "Bookmarks",
|
if key_obj == nil or key_obj.path == path then
|
||||||
content = "Duplicated key",
|
break
|
||||||
timeout = 2,
|
else
|
||||||
level = "info",
|
ya.notify({
|
||||||
}
|
title = "Bookmarks",
|
||||||
end
|
content = "Duplicated key",
|
||||||
else
|
timeout = 2,
|
||||||
ya.notify {
|
level = "info",
|
||||||
title = "Bookmarks",
|
})
|
||||||
content = "The length of key shoule be 1",
|
end
|
||||||
timeout = 2,
|
else
|
||||||
level = "info",
|
ya.notify({
|
||||||
}
|
title = "Bookmarks",
|
||||||
end
|
content = "The length of key shoule be 1",
|
||||||
end
|
timeout = 2,
|
||||||
-- save
|
level = "info",
|
||||||
set_bookmarks(path, { tag = tag, path = path, key = key })
|
})
|
||||||
bookmarks = get_state_attr("bookmarks")
|
end
|
||||||
save_to_file(mb_path, bookmarks)
|
end
|
||||||
ya.notify {
|
-- save
|
||||||
title = "Bookmarks",
|
set_bookmarks(path, { tag = tag, path = path, key = key })
|
||||||
content = '"' .. tag .. '" saved"',
|
bookmarks = get_state_attr("bookmarks")
|
||||||
timeout = 2,
|
save_to_file(mb_path, bookmarks)
|
||||||
level = "info",
|
ya.notify({
|
||||||
}
|
title = "Bookmarks",
|
||||||
|
content = '"' .. tag .. '" saved"',
|
||||||
|
timeout = 2,
|
||||||
|
level = "info",
|
||||||
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local action_delete = function(mb_path, bookmarks, path)
|
local action_delete = function(mb_path, bookmarks, path)
|
||||||
if path == nil then
|
if path == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local tag = bookmarks[path].tag
|
local tag = bookmarks[path].tag
|
||||||
set_bookmarks(path, nil)
|
set_bookmarks(path, nil)
|
||||||
bookmarks = get_state_attr("bookmarks")
|
bookmarks = get_state_attr("bookmarks")
|
||||||
save_to_file(mb_path, bookmarks)
|
save_to_file(mb_path, bookmarks)
|
||||||
ya.notify {
|
ya.notify({
|
||||||
title = "Bookmarks",
|
title = "Bookmarks",
|
||||||
content = '"' .. tag .. '" deleted',
|
content = '"' .. tag .. '" deleted',
|
||||||
timeout = 2,
|
timeout = 2,
|
||||||
level = "info",
|
level = "info",
|
||||||
}
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
local action_delete_all = function(mb_path)
|
local action_delete_all = function(mb_path)
|
||||||
local value, event = ya.input({
|
local value, event = ya.input({
|
||||||
title = "Delete all bookmarks? (y/n)",
|
title = "Delete all bookmarks? (y/n)",
|
||||||
position = { "top-center", y = 3, w = 40 },
|
pos = { "top-center", y = 3, w = 40 },
|
||||||
})
|
-- TODO: remove this after next yazi released
|
||||||
if event ~= 1 then
|
position = { "top-center", y = 3, w = 40 },
|
||||||
return
|
})
|
||||||
end
|
if event ~= 1 then
|
||||||
if string.lower(value) == "y" then
|
return
|
||||||
set_state_attr("bookmarks", {})
|
end
|
||||||
save_to_file(mb_path, {})
|
if value and string.lower(value) == "y" then
|
||||||
ya.notify {
|
set_state_attr("bookmarks", {})
|
||||||
title = "Bookmarks",
|
save_to_file(mb_path, {})
|
||||||
content = "All bookmarks deleted",
|
ya.notify({
|
||||||
timeout = 2,
|
title = "Bookmarks",
|
||||||
level = "info",
|
content = "All bookmarks deleted",
|
||||||
}
|
timeout = 2,
|
||||||
else
|
level = "info",
|
||||||
ya.notify {
|
})
|
||||||
title = "Bookmarks",
|
else
|
||||||
content = "Cancel delete",
|
ya.notify({
|
||||||
timeout = 2,
|
title = "Bookmarks",
|
||||||
level = "info",
|
content = "Cancel delete",
|
||||||
}
|
timeout = 2,
|
||||||
end
|
level = "info",
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
setup = function(state, options)
|
setup = function(state, options)
|
||||||
state.path = options.path or
|
state.path = options.path
|
||||||
(ya.target_family() == "windows" and os.getenv("APPDATA") .. "\\yazi\\config\\bookmark") or
|
or (ya.target_family() == "windows" and os.getenv("APPDATA") .. "\\yazi\\config\\bookmark")
|
||||||
(os.getenv("HOME") .. "/.config/yazi/bookmark")
|
or (os.getenv("HOME") .. "/.config/yazi/bookmark")
|
||||||
state.cli = options.cli or "fzf"
|
state.cli = options.cli or "fzf"
|
||||||
state.jump_notify = options.jump_notify and true
|
state.jump_notify = options.jump_notify and true
|
||||||
-- init the keys
|
-- init the keys
|
||||||
local keys = options.keys or "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
local keys = options.keys or "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||||
state.keys = {}
|
state.keys = {}
|
||||||
state.key2rank = {}
|
state.key2rank = {}
|
||||||
for i = 1, #keys do
|
for i = 1, #keys do
|
||||||
local char = keys:sub(i, i)
|
local char = keys:sub(i, i)
|
||||||
table.insert(state.keys, char)
|
table.insert(state.keys, char)
|
||||||
state.key2rank[char] = i
|
state.key2rank[char] = i
|
||||||
end
|
end
|
||||||
|
|
||||||
-- init the bookmarks
|
-- init the bookmarks
|
||||||
local bookmarks = {}
|
local bookmarks = {}
|
||||||
for _, item in pairs(options.bookmarks or {}) do
|
for _, item in pairs(options.bookmarks or {}) do
|
||||||
bookmarks[item.path] = { tag = item.tag, path = item.path, key = item.key }
|
bookmarks[item.path] = { tag = item.tag, path = item.path, key = item.key }
|
||||||
end
|
if not state.key2rank[item.key] then
|
||||||
-- load the config
|
state.key2rank[item.key] = #state.key2rank + 1
|
||||||
local file = io.open(state.path, "r")
|
state.keys[#state.keys + 1] = item.key
|
||||||
if file ~= nil then
|
end
|
||||||
for line in file:lines() do
|
end
|
||||||
local tag, path, key = string.match(line, "(.-)\t(.-)\t(.*)")
|
-- load the config
|
||||||
if tag and path then
|
local file = io.open(state.path, "r")
|
||||||
key = key or ""
|
if file ~= nil then
|
||||||
bookmarks[path] = { tag = tag, path = path, key = key }
|
for line in file:lines() do
|
||||||
end
|
local tag, path, key = string.match(line, "(.-)\t(.-)\t(.*)")
|
||||||
end
|
if tag and path then
|
||||||
file:close()
|
key = key or ""
|
||||||
end
|
bookmarks[path] = { tag = tag, path = path, key = key }
|
||||||
-- create bookmarks file to enable fzf
|
end
|
||||||
save_to_file(state.path, bookmarks)
|
end
|
||||||
state.bookmarks = bookmarks
|
file:close()
|
||||||
end,
|
end
|
||||||
entry = function(self, jobs)
|
-- create bookmarks file to enable fzf
|
||||||
local action = jobs.args[1]
|
save_to_file(state.path, bookmarks)
|
||||||
if not action then
|
state.bookmarks = bookmarks
|
||||||
return
|
end,
|
||||||
end
|
entry = function(self, jobs)
|
||||||
local mb_path, cli, bookmarks, jump_notify = get_state_attr("path"), get_state_attr("cli"), get_state_attr("bookmarks"), get_state_attr("jump_notify")
|
local action = jobs.args[1]
|
||||||
if action == "save" then
|
if not action then
|
||||||
action_save(mb_path, bookmarks, get_hovered_path())
|
return
|
||||||
elseif action == "delete_by_key" then
|
end
|
||||||
action_delete(mb_path, bookmarks, which_find(bookmarks))
|
local mb_path, cli, bookmarks, jump_notify =
|
||||||
elseif action == "delete_by_fzf" then
|
get_state_attr("path"), get_state_attr("cli"), get_state_attr("bookmarks"), get_state_attr("jump_notify")
|
||||||
action_delete(mb_path, bookmarks, fzf_find(cli, mb_path))
|
if action == "save" then
|
||||||
elseif action == "delete_all" then
|
action_save(mb_path, bookmarks, get_hovered_path())
|
||||||
action_delete_all(mb_path)
|
elseif action == "delete_by_key" then
|
||||||
elseif action == "jump_by_key" then
|
action_delete(mb_path, bookmarks, which_find(bookmarks))
|
||||||
action_jump(bookmarks, which_find(bookmarks), jump_notify)
|
elseif action == "delete_by_fzf" then
|
||||||
elseif action == "jump_by_fzf" then
|
action_delete(mb_path, bookmarks, fzf_find(cli, mb_path))
|
||||||
action_jump(bookmarks, fzf_find(cli, mb_path), jump_notify)
|
elseif action == "delete_all" then
|
||||||
elseif action == "rename_by_key" then
|
action_delete_all(mb_path)
|
||||||
action_save(mb_path, bookmarks, which_find(bookmarks))
|
elseif action == "jump_by_key" then
|
||||||
elseif action == "rename_by_fzf" then
|
action_jump(bookmarks, which_find(bookmarks), jump_notify)
|
||||||
action_save(mb_path, bookmarks, fzf_find(cli, mb_path))
|
elseif action == "jump_by_fzf" then
|
||||||
end
|
action_jump(bookmarks, fzf_find(cli, mb_path), jump_notify)
|
||||||
end,
|
elseif action == "rename_by_key" then
|
||||||
|
action_save(mb_path, bookmarks, which_find(bookmarks))
|
||||||
|
elseif action == "rename_by_fzf" then
|
||||||
|
action_save(mb_path, bookmarks, fzf_find(cli, mb_path))
|
||||||
|
end
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ This setup allows shipping stable versions on time, while giving early access to
|
|||||||
|
|
||||||
| yaziline | yazi |
|
| 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) | [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) |
|
| [v2.5.2](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.2) | [917e1f5](https://github.com/sxyazi/yazi/commit/917e1f54a10445f2e25147c4b81a3c77d8233632) |
|
||||||
| [v2.5.1](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.1) | [917e1f5](https://github.com/sxyazi/yazi/commit/917e1f54a10445f2e25147c4b81a3c77d8233632) |
|
| [v2.5.1](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.1) | [917e1f5](https://github.com/sxyazi/yazi/commit/917e1f54a10445f2e25147c4b81a3c77d8233632) |
|
||||||
| [v2.5.0](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.0) | [v25.5.28](https://github.com/sxyazi/yazi/releases/tag/v25.5.28) |
|
| [v2.5.0](https://github.com/llanosrocas/yaziline.yazi/releases/tag/v2.5.0) | [v25.5.28](https://github.com/sxyazi/yazi/releases/tag/v25.5.28) |
|
||||||
|
|||||||
@@ -358,6 +358,8 @@
|
|||||||
- 同时启用 Vulkan 上下文中的软件光栅化驱动 swrast 以防万一。
|
- 同时启用 Vulkan 上下文中的软件光栅化驱动 swrast 以防万一。
|
||||||
- `-D glvnd=enabled`:启用 GLVND 支持以便和 NVIDIA 专有驱动兼容。libglvnd 需要[在 GLFS 书中安装](https://glfs-book.github.io/glfs/shareddeps/libglvnd.html)。
|
- `-D glvnd=enabled`:启用 GLVND 支持以便和 NVIDIA 专有驱动兼容。libglvnd 需要[在 GLFS 书中安装](https://glfs-book.github.io/glfs/shareddeps/libglvnd.html)。
|
||||||
|
|
||||||
|
> 虽然 GLFS 中的 libglvnd 章节在开头处提到了 `If you've come here from the BLFS Mesa page, ...`,但实际上 BLFS 中的 Mesa 章节并没有提到 libglvnd 和除 nouveau 外与 NVIDIA 相关的话题。算个小坑?大概。
|
||||||
|
|
||||||
- [Qt-6.9.2](https://www.linuxfromscratch.org/blfs/view/stable/x/qt6.html)
|
- [Qt-6.9.2](https://www.linuxfromscratch.org/blfs/view/stable/x/qt6.html)
|
||||||
|
|
||||||
此版本的 Qt 的 geoclue2 模块在特定条件下构建时可能会出现错误,日志的一部分如下:
|
此版本的 Qt 的 geoclue2 模块在特定条件下构建时可能会出现错误,日志的一部分如下:
|
||||||
|
|||||||
Reference in New Issue
Block a user