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:
13
lua/nvim-tree/actions/dir-up.lua
Normal file
13
lua/nvim-tree/actions/dir-up.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
local M = {}
|
||||
|
||||
function M.fn(node)
|
||||
if not node or node.name == ".." then
|
||||
return require'nvim-tree.actions.change-dir'.fn('..')
|
||||
else
|
||||
local newdir = vim.fn.fnamemodify(require'nvim-tree.lib'.Tree.cwd, ':h')
|
||||
require'nvim-tree.actions.change-dir'.fn(newdir)
|
||||
return require'nvim-tree.lib'.set_index_and_redraw(node.absolute_path)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user