feat: add vinegar abilities to the tree

fixes #860
This commit is contained in:
kiyan
2022-02-21 21:42:43 +01:00
parent f977e5c05a
commit f8f297acbf
6 changed files with 84 additions and 11 deletions

View File

@@ -44,6 +44,25 @@ function M.open(cwd)
end
end
function M.open_replacing_current_buffer()
if view.is_visible() then
return
end
local buf = api.nvim_get_current_buf()
local bufname = api.nvim_buf_get_name(buf)
if bufname == "" or vim.loop.fs_stat(bufname) == nil then
return
end
local cwd = vim.fn.fnamemodify(bufname, ':p:h')
if not TreeExplorer or cwd ~= TreeExplorer.cwd then
lib.init(cwd)
end
view.open_in_current_win({ hijack_current_buf = false, resize = false })
require"nvim-tree.renderer".draw()
end
function M.tab_change()
if view.is_visible({ any_tabpage = true }) then
local bufname = vim.api.nvim_buf_get_name(0)