mirror of
https://github.com/kristoferssolo/solorice.git
synced 2026-03-18 08:09:40 +00:00
Use dotter
This commit is contained in:
27
config/yazi/plugins/starship.yazi/init.lua
Normal file
27
config/yazi/plugins/starship.yazi/init.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
local save = ya.sync(function(st, cwd, output)
|
||||
if cx.active.current.cwd == Url(cwd) then
|
||||
st.output = output
|
||||
ya.render()
|
||||
end
|
||||
end)
|
||||
|
||||
return {
|
||||
setup = function(st)
|
||||
Header.cwd = function()
|
||||
local cwd = cx.active.current.cwd
|
||||
if st.cwd ~= cwd then
|
||||
st.cwd = cwd
|
||||
ya.manager_emit("plugin", { st._name, args = ya.quote(tostring(cwd)) })
|
||||
end
|
||||
|
||||
return ui.Line.parse(st.output or "")
|
||||
end
|
||||
end,
|
||||
|
||||
entry = function(_, args)
|
||||
local output = Command("starship"):arg("prompt"):cwd(args[1]):env("STARSHIP_SHELL", ""):output()
|
||||
if output then
|
||||
save(args[1], output.stdout:gsub("^%s+", ""))
|
||||
end
|
||||
end,
|
||||
}
|
||||
Reference in New Issue
Block a user