Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions yazi-plugin/preset/plugins/fzf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@ local state = ya.sync(function()
return cx.active.current.cwd, selected
end)

function M:setup(opts)
opts = opts or {}
self.args = opts.args
end

function M:entry()
ya.emit("escape", { visual = true })

local _permit = ya.hide()
local cwd, selected = state()

local output, err = M.run_with(cwd, selected)
local output, err = self:run_with(cwd, selected)
if not output then
return ya.notify { title = "Fzf", content = tostring(err), timeout = 5, level = "error" }
end
Expand All @@ -29,9 +34,10 @@ function M:entry()
end
end

function M.run_with(cwd, selected)
function M:run_with(cwd, selected)
local child, err = Command("fzf")
:arg("-m")
:args(self.args or {})
:cwd(tostring(cwd))
:stdin(#selected > 0 and Command.PIPED or Command.INHERIT)
:stdout(Command.PIPED)
Expand Down
6 changes: 3 additions & 3 deletions yazi-plugin/preset/plugins/magick.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ function M:spot(job) require("file"):spot(job) end
function M.with_limit()
local cmd = Command("magick"):args { "-limit", "thread", 1 }
if rt.tasks.image_alloc > 0 then
cmd = cmd:args({ "-limit", "memory", rt.tasks.image_alloc }):args { "-limit", "disk", "1MiB" }
cmd:args({ "-limit", "memory", rt.tasks.image_alloc }):args { "-limit", "disk", "1MiB" }
end
if rt.tasks.image_bound[1] > 0 then
cmd = cmd:args { "-limit", "width", rt.tasks.image_bound[1] }
cmd:args { "-limit", "width", rt.tasks.image_bound[1] }
end
if rt.tasks.image_bound[2] > 0 then
cmd = cmd:args { "-limit", "height", rt.tasks.image_bound[2] }
cmd:args { "-limit", "height", rt.tasks.image_bound[2] }
end
return cmd
end
Expand Down
Loading