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

Error detected while processing WinEnter Autocommands for "*"..function <SNR>38_HandleOnlyWindow[13]..<SNR>38_CloseWindow #869

Closed
lijh8 opened this issue Feb 1, 2024 · 4 comments

Comments

@lijh8
Copy link

lijh8 commented Feb 1, 2024

Hi, i'm using vim with nerdtree and tagbar.
with both nerdtree and tagbar toggled on, when i quit editing my last c++ source file, there's this error.
Do not know whether it's related to nerdtree, tagbar, or vim.

https://github.com/preservim/nerdtree ,

Error detected while processing WinEnter Autocommands for "*"..function <SNR>38_HandleOnlyWindow[13]..<SNR>38_CloseWindow:
line   21:
E1312: Not allowed to change the window layout in this autocmd


this is ~/.vimrc:



set expandtab
set hlsearch
set nowrapscan
set shiftwidth=4
set smartindent
set tabstop=4
syntax off

" NERDTree
autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
autocmd VimEnter * NERDTree
let g:NERDTreeNodeDelimiter = "\u00a0"
nnoremap <leader>n :NERDTreeFocus<CR> " \ - n
nnoremap <C-n> :NERDTree<CR>          " Ctrl - n
nnoremap <C-t> :NERDTreeToggle<CR>    " Ctrl - t
nnoremap <C-f> :NERDTreeFind<CR>

" tagbar
filetype on            " Tagbar: Filetype detection is turned off, skipping plugin
let g:tagbar_sort = 0  " order of position
nmap <F8> :TagbarToggle<CR>

Screen Shot 2024-02-01 at 22 33 58
Screen Shot 2024-02-01 at 22 34 04

@raven42
Copy link
Collaborator

raven42 commented Feb 1, 2024

I'm guessing you are running vim-9.0. This is a new issue that has been reported in #851. Some of the auto-command behavior has changed with vim-9.0. Unfortunately I haven't been able to come up with a good workaround yet (just haven't been able to spend time on it). We are open to PRs if anyone else has any ideas or options that will work.

Closing this for now as duplicate of #851.

@lijh8 if you are NOT running vim-9.0 and seeing this behavior, please reopen this issue, but otherwise we will track under the original issue.

@yousong
Copy link

yousong commented Feb 29, 2024

Hi @lijh8 , I just created a small pull request for fixing this issue. Please consider giving it a try ;)

@yousong
Copy link

yousong commented Feb 29, 2024

Hi @lijh8 , I just created a small pull request for fixing this issue. Please consider giving it a try ;)

Oops, here is the link to the pull request: #875

@lijh8
Copy link
Author

lijh8 commented Feb 29, 2024

here is the link to the pull request: #875

Hi, when I open both nerdtree and tagbar in vim and then :quit, it still needs this in ~/.vimrc:

autocmd QuitPre * qall 

Or, it reports this:

Error detected while processing WinEnter Autocommands for "*"..function <SNR>40_HandleOnlyWindow[13]..<SNR>40_CloseWindow:
line   21:
E1312: Not allowed to change the window layout in this autocmd

$ pwd
/Users/ljh/.vim/pack/vendor/start/tagbar/autoload
$
$ diff -ru tagbar.vim.bak tagbar.vim

--- tagbar.vim.bak	2024-02-29 20:26:44.000000000 +0800
+++ tagbar.vim	2024-02-29 20:32:33.000000000 +0800
@@ -3541,7 +3541,9 @@
 
         try
             try
-                quit
+                " quit
+                call timer_start(0, {-> execute('q', 'silent!') })
+
             catch /.*/ " This can be E173 and maybe others
                 call s:OpenWindow('')
                 echoerr v:exception
 

$

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

No branches or pull requests

3 participants