how do i reset the window size from the last time
https://user-images.githubusercontent.com/43649186/193557293-73aea9f5-a354-4b5a-9ca1-12ca3b191f34.mp4
The undotree window will remember its width so that you don't have to resize it (e.g. when the line width is not long enough to show all the info) every time you bring it up. In this case when you close the file tree the undotree window gets resized automatically. Although it might not be the intention of the user, that's the default behavior of vim.
You can try to manually resize the undotree window with mouse or resizing command but if you need the panel to restore to its original size even after it gets automatically resized, you may try to hack the plugin to add some resizing autocommand on some events like bufenter.
@HUAHUAI23 can you please post the solution if you come up with anything.
i solved this
local api = vim.api
local function setUndotreeWinSize()
local winList = api.nvim_list_wins()
for _, winHandle in ipairs(winList) do
if
api.nvim_win_is_valid(winHandle)
and api.nvim_buf_get_option(api.nvim_win_get_buf(winHandle), "filetype") == "undotree"
then
api.nvim_win_set_width(winHandle, vim.g.undotree_SplitWidth)
end
end
end
api.nvim_create_user_command("Ut", function()
api.nvim_cmd(api.nvim_parse_cmd("UndotreeToggle", {}), {})
setUndotreeWinSize()
end, { desc = "load undotree" })
wrap UndotreeToggle command with mine,it will set undotree window size