update
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:git"
|
||||
rev = "b9598e6"
|
||||
hash = "ce259b12c503a33a18a861052fa582b7"
|
||||
rev = "0be29a9"
|
||||
hash = "fbb53c3c04f816d737f9f4b1d29f3310"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "yazi-rs/plugins:smart-enter"
|
||||
rev = "b9598e6"
|
||||
rev = "0be29a9"
|
||||
hash = "187cc58ba7ac3befd49c342129e6f1b6"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "h-hg/yamb"
|
||||
rev = "5576bd7"
|
||||
hash = "2cf0dcda0e16e77342ae50c50134d238"
|
||||
rev = "971b858"
|
||||
hash = "da4534745930e827a44d4585bbd965eb"
|
||||
|
||||
[[plugin.deps]]
|
||||
use = "KKV9/compress"
|
||||
|
||||
@@ -262,4 +262,14 @@ local function fetch(_, job)
|
||||
return false
|
||||
end
|
||||
|
||||
return { setup = setup, fetch = fetch }
|
||||
-- TODO: remove
|
||||
local function fetch_compact(self, job)
|
||||
if ya.throttle then
|
||||
fetch(self, job)
|
||||
return require("noop"):fetch(job)
|
||||
else
|
||||
return fetch(self, job)
|
||||
end
|
||||
end
|
||||
|
||||
return { setup = setup, fetch = fetch_compact }
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
--- @since 25.6.11
|
||||
local path_sep = package.config:sub(1, 1)
|
||||
|
||||
local get_hovered_path = ya.sync(function(state)
|
||||
local get_hovered_path = ya.sync(function(_)
|
||||
local is_virtual = (Url(cx.active.current.hovered.url).spec and Url(cx.active.current.hovered.url).spec.is_virtual)
|
||||
or (not Url(cx.active.current.hovered.url).spec and Url(cx.active.current.hovered.url).scheme.is_virtual)
|
||||
|
||||
local h = cx.active.current.hovered
|
||||
if h then
|
||||
local path = tostring(h.url)
|
||||
local path = tostring(is_virtual and h.url or h.url.path)
|
||||
if h.cha.is_dir then
|
||||
return path .. path_sep
|
||||
end
|
||||
@@ -65,7 +68,7 @@ local save_to_file = function(mb_path, bookmarks)
|
||||
end
|
||||
|
||||
local fzf_find = function(cli, mb_path)
|
||||
local permit = ya.hide()
|
||||
local permit = (ui.hide or ya.hide)()
|
||||
local cmd = string.format('%s < "%s"', cli, mb_path)
|
||||
local handle = io.popen(cmd, "r")
|
||||
local result = ""
|
||||
@@ -79,9 +82,37 @@ local fzf_find = function(cli, mb_path)
|
||||
return path
|
||||
end
|
||||
|
||||
local generate_key = function(bookmarks)
|
||||
local keys = get_state_attr("keys")
|
||||
local key2rank = get_state_attr("key2rank")
|
||||
local mb = {}
|
||||
for _, item in pairs(bookmarks) do
|
||||
if #item.key == 1 and key2rank[item.key] then
|
||||
table.insert(mb, item.key)
|
||||
end
|
||||
end
|
||||
if #mb == 0 then
|
||||
return keys[1]
|
||||
end
|
||||
table.sort(mb, function(a, b)
|
||||
return key2rank[a] < key2rank[b]
|
||||
end)
|
||||
local idx = 1
|
||||
for _, key in ipairs(keys) do
|
||||
if idx > #mb or key2rank[key] < key2rank[mb[idx]] then
|
||||
return key
|
||||
end
|
||||
idx = idx + 1
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local which_find = function(bookmarks)
|
||||
local cands = {}
|
||||
for path, item in pairs(bookmarks) do
|
||||
for _, item in pairs(bookmarks) do
|
||||
if not item.key or item.key == "" then
|
||||
item.key = generate_key(bookmarks)
|
||||
end
|
||||
if #item.tag ~= 0 then
|
||||
table.insert(cands, { desc = item.tag, on = item.key, path = item.path })
|
||||
end
|
||||
@@ -111,7 +142,7 @@ local action_jump = function(bookmarks, path, jump_notify)
|
||||
if string.sub(path, -1) == path_sep then
|
||||
ya.emit("cd", { path, raw = true })
|
||||
else
|
||||
ya.emit("reveal", { path, no_dummy = true, raw = true })
|
||||
ya.emit("reveal", { path, no_dummy = not fs.cha(Url(path), false), raw = true })
|
||||
end
|
||||
if jump_notify then
|
||||
ya.notify({
|
||||
@@ -123,31 +154,6 @@ local action_jump = function(bookmarks, path, jump_notify)
|
||||
end
|
||||
end
|
||||
|
||||
local generate_key = function(bookmarks)
|
||||
local keys = get_state_attr("keys")
|
||||
local key2rank = get_state_attr("key2rank")
|
||||
local mb = {}
|
||||
for _, item in pairs(bookmarks) do
|
||||
if #item.key == 1 and key2rank[item.key] then
|
||||
table.insert(mb, item.key)
|
||||
end
|
||||
end
|
||||
if #mb == 0 then
|
||||
return keys[1]
|
||||
end
|
||||
table.sort(mb, function(a, b)
|
||||
return key2rank[a] < key2rank[b]
|
||||
end)
|
||||
local idx = 1
|
||||
for _, key in ipairs(keys) do
|
||||
if idx > #mb or key2rank[key] < key2rank[mb[idx]] then
|
||||
return key
|
||||
end
|
||||
idx = idx + 1
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
local action_save = function(mb_path, bookmarks, path)
|
||||
if path == nil or #path == 0 then
|
||||
return
|
||||
@@ -208,11 +214,10 @@ local action_save = function(mb_path, bookmarks, path)
|
||||
if event ~= 1 then
|
||||
return
|
||||
end
|
||||
key = value or ""
|
||||
if key == "" then
|
||||
key = ""
|
||||
if not value or value == "" then
|
||||
break
|
||||
elseif #key == 1 then
|
||||
key = value
|
||||
-- check the key
|
||||
local key_obj = nil
|
||||
for _, item in pairs(bookmarks) do
|
||||
|
||||
Reference in New Issue
Block a user