mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
5dc4695e98
commit
e13a03ce4e
1 changed files with 6 additions and 11 deletions
|
|
@ -8,11 +8,9 @@ local state = ya.sync(function()
|
||||||
return cx.active.current.cwd, selected
|
return cx.active.current.cwd, selected
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function M:setup(tbl)
|
function M:setup(opts)
|
||||||
tbl = tbl or {}
|
opts = opts or {}
|
||||||
if tbl.opts then
|
self.args = opts.args
|
||||||
self.opts = table.concat(tbl.opts, " ")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:entry()
|
function M:entry()
|
||||||
|
|
@ -37,17 +35,14 @@ function M:entry()
|
||||||
end
|
end
|
||||||
|
|
||||||
function M:run_with(cwd, selected)
|
function M:run_with(cwd, selected)
|
||||||
local cmd = Command("fzf")
|
local child, err = Command("fzf")
|
||||||
:arg("-m")
|
:arg("-m")
|
||||||
|
:args(self.args or {})
|
||||||
:cwd(tostring(cwd))
|
:cwd(tostring(cwd))
|
||||||
:stdin(#selected > 0 and Command.PIPED or Command.INHERIT)
|
:stdin(#selected > 0 and Command.PIPED or Command.INHERIT)
|
||||||
:stdout(Command.PIPED)
|
:stdout(Command.PIPED)
|
||||||
|
:spawn()
|
||||||
|
|
||||||
if self.opts then
|
|
||||||
cmd:env("FZF_DEFAULT_OPTS", self.opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
local child, err = cmd:spawn()
|
|
||||||
if not child then
|
if not child then
|
||||||
return nil, Err("Failed to start `fzf`, error: %s", err)
|
return nil, Err("Failed to start `fzf`, error: %s", err)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue