Hidden explorer root dir #2010
-
I wrote a snippet to hide root directory in the picker explorer sources. Could you any suggestion about this logic? It appears working. ---@type fun(item:snacks.picker.finder.Item, ctx:snacks.picker.finder.ctx):(boolean|snacks.picker.finder.Item|nil)
transform = function(item, _)
if item.dir and item.parent == nil then
return false
end
local original = table.deepcopy(item)
local cur = original
while cur.parent ~= nil do
if cur.parent.parent == nil then
cur.parent = nil
break
end
cur = cur.parent
end
return original
end,
|
Beta Was this translation helpful? Give feedback.
Answered by
drowning-cat
Jul 2, 2025
Replies: 1 comment
-
Why not? Looks good. I’d probably do something a bit more hacky myself: transform = function(item)
if item.parent == nil then
return false
end
if item.parent.parent == nil then
item.parent = false
end
end, |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mym0404
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why not? Looks good. I’d probably do something a bit more hacky myself: