refacto: abstract TreeExplorer in core.lua
This commit is contained in:
26
lua/nvim-tree/core.lua
Normal file
26
lua/nvim-tree/core.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
local events = require "nvim-tree.events"
|
||||
local explorer = require "nvim-tree.explorer"
|
||||
|
||||
local M = {}
|
||||
|
||||
local first_init_done = false
|
||||
|
||||
TreeExplorer = nil
|
||||
|
||||
function M.init(foldername)
|
||||
TreeExplorer = explorer.Explorer.new(foldername)
|
||||
if not first_init_done then
|
||||
events._dispatch_ready()
|
||||
first_init_done = true
|
||||
end
|
||||
end
|
||||
|
||||
function M.get_explorer()
|
||||
return TreeExplorer
|
||||
end
|
||||
|
||||
function M.get_cwd()
|
||||
return TreeExplorer.cwd
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user