refacto: move some code into actions
(non breaking, old assignments link to new assignments) - move lib.collapse-all into actions/collapse-all - move lib.dir-up into actions/dir-up - move lib.change-dir into actions/change-dir - use setup option for change-dir global (and use the old option for setup)
This commit is contained in:
19
lua/nvim-tree/actions/collapse-all.lua
Normal file
19
lua/nvim-tree/actions/collapse-all.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local M = {}
|
||||
|
||||
function M.fn()
|
||||
local function iter(nodes)
|
||||
for _, node in pairs(nodes) do
|
||||
if node.open then
|
||||
node.open = false
|
||||
end
|
||||
if node.entries then
|
||||
iter(node.entries)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
iter(require'nvim-tree.lib'.Tree.entries)
|
||||
require'nvim-tree.lib'.redraw()
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user