Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] undotree become empty #129

Open
Freed-Wu opened this issue Aug 31, 2021 · 7 comments
Open

[bug] undotree become empty #129

Freed-Wu opened this issue Aug 31, 2021 · 7 comments

Comments

@Freed-Wu
Copy link

" $ uname -r
" 5.13.13-arch1-1
" $ has nvim
" ✓ nvim 0.5.0
" $ cat test.vim
set runtimepath=$VIMRUNTIME
set runtimepath+=~/.local/share/nvim/repos/github.com/mbbill/undotree
set undofile
autocmd VimEnter * UndotreeShow
" $ vi -u test.vim one_file_has_undo_histories.

Screenshot from 2021-08-31 13-24-05

Press <C-w>o
Screenshot from 2021-08-31 13-24-10

Press :UndotreeShow<CR>
Screenshot from 2021-08-31 13-24-16

The undotree is empty!

@mbbill
Copy link
Owner

mbbill commented Sep 1, 2021

the tree should show up once you move the focus to the right side

@Freed-Wu
Copy link
Author

Freed-Wu commented Sep 1, 2021

the tree should show up once you move the focus to the right side

Thanks.

When I UndotreeShow firstly, the cursor is in the current buffer and the
undotree display. However, when I UndotreeShow secondly, the cursor moves to
the undotree buffer? This is why?

@mbbill
Copy link
Owner

mbbill commented Sep 7, 2021

I'm not exactly sure, but I guess it might be related to how VIM handles the 'previous window'.

@Freed-Wu
Copy link
Author

So it is a bug of (n)vim? 😄

@RayZ0rr
Copy link

RayZ0rr commented Jan 28, 2022

Also, experiencing this bug.

Closing undotree window with q shows no bug. However closing undotree with :q or ZQ shows this behavior.

@EtiamNullam
Copy link

EtiamNullam commented Apr 29, 2022

So it is a bug of (n)vim? 😄

@Freed-Wu: I can replicate it in vim 8.1

@RayZ0rr: Good catch!

@EtiamNullam
Copy link

I made this hack in lua for neovim as a workaround:

local function enter_undotree()
    vim.api.nvim_command('UndotreeShow')

    local is_glitched = vim.fn.getreg('%') == 'undotree_2'

    if is_glitched then
        vim.api.nvim_command [[
            wincmd w
            wincmd w
            wincmd p
        ]]
    else
        vim.api.nvim_command('UndotreeFocus')
    end
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants