feat: reset old window when leaving the tree

This commit is contained in:
kiyan
2021-05-28 09:13:37 +02:00
parent 23935ff003
commit be184bd94e
2 changed files with 16 additions and 0 deletions

View File

@@ -194,6 +194,20 @@ function M.reset_highlight()
renderer.render_hl(view.View.bufnr)
end
local old_win = nil
function M.save_previous_buf()
vim.cmd "wincmd p"
old_win = api.nvim_get_current_win()
vim.cmd "wincmd p"
end
function M.set_previous_buf()
if old_win then
api.nvim_set_current_win(old_win)
end
end
view.setup()
colors.setup()
vim.defer_fn(M.on_enter, 1)