How can I expand all nodes in the explorer tree based on depth level? #2607
Replies: 2 comments 3 replies
opts = {
picker = {
sources = {
explorer = {
on_show = function(picker)
local Tree = require("snacks.explorer.tree")
local root = Tree:find(picker:cwd())
local open_recursive = false
Tree:walk(root, function(node)
if node.dir and (open_recursive or root == node.parent) then
Tree:open(node.path)
Tree:expand(node)
end
end, { all = open_recursive })
end, |
3 replies
Answer selected by
pczern
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'd like to expand all nodes in the explorer tree by default or just the first level. How can this be accomplished?
All reactions