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

vim-9.0: The autoclose functionality is not behaving correctly #851

Open
raven42 opened this issue Apr 4, 2023 · 2 comments · May be fixed by #875
Open

vim-9.0: The autoclose functionality is not behaving correctly #851

raven42 opened this issue Apr 4, 2023 · 2 comments · May be fixed by #875
Labels
bug vim-9.0 Any issues that pertain only to vim-9.0

Comments

@raven42
Copy link
Collaborator

raven42 commented Apr 4, 2023

In the s:HandleOnlyWindow() routine, currently the autoclose is not behaving correctly. With the introduction of vim-9.0 (patch-9.0.907) the quit while inside an autocmd no longer functions.

Have started a fix for this to use the feedkeys(), however that doesn't handle each case. It issues the :quit no matter what even in an E173 (Additional files open), and just blows the windows away regardless. We may have to do away with the autoclose and instead guide users to a more streamlined option like this:

autocmd QuitPre * qa
@yousong
Copy link

yousong commented Feb 28, 2024

Not sure if it's a proper/minimal one but the the following patch seems to fix the issue for me. The idea is taken from this link

diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim
index de8b4b3..db90f53 100644
--- a/autoload/tagbar.vim
+++ b/autoload/tagbar.vim
@@ -3540,7 +3540,7 @@ function! s:HandleOnlyWindow() abort
 
         try
             try
-                quit
+                call timer_start(0, {-> execute('q', 'silent!') })
             catch /.*/ " This can be E173 and maybe others
                 call s:OpenWindow('')
                 echoerr v:exception

@raven42
Copy link
Collaborator Author

raven42 commented Feb 28, 2024

That looks like it could work. If you want to push up a pull request, then if anybody else wants to help test it out as well we could get that in.

yousong added a commit to yousong/tagbar that referenced this issue Feb 29, 2024
The idea is taken from README.md of MattLombana/dotfiles

Fixes preservim#851
@yousong yousong linked a pull request Feb 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug vim-9.0 Any issues that pertain only to vim-9.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants