feat: add ability to not hijack the unnamed buffer

This commit is contained in:
kiyan
2022-02-16 21:00:28 +01:00
parent 015e7e8611
commit 76d4ed5d77
4 changed files with 55 additions and 37 deletions

View File

@@ -18,7 +18,11 @@ function M.init(with_open, foldername)
TreeExplorer = explorer.Explorer.new(foldername)
TreeExplorer:init(function()
if with_open then
view.open_in_current_win()
if M.hijack_unnamed_buffer_when_opening then
view.open_in_current_win()
else
view.open()
end
end
renderer.draw()
@@ -143,4 +147,8 @@ M.reload_git = require'nvim-tree.actions.reloaders'.reload_git
-- @deprecated: use nvim-tree.actions.find-file.fn
M.set_index_and_redraw = require'nvim-tree.actions.find-file'.fn
function M.setup(opts)
M.hijack_unnamed_buffer_when_opening = opts.hijack_unnamed_buffer_when_opening
end
return M