0

Executing :q! and :wq! (of course :x as well) on any Python files causing "E855: Autocommands caused command to abort". However, :qa , :wqa (and of course :xa as well) don't caused the same error, my guess because they safe all buffers (files) before quitting. But I don't get it because I don't have multiple files opened anyway, just one file, so why :wq! doesn't work ? This screenshot is a sample error from trying to quit using :wq! :

(screenshot)

Not many suggestions I could find on E855, but one suggested to disable Python tagbar close in vimrc to make :wq! work :

autocmd BufWinLeave *.py :TagbarClose

I did disable it (line 156 in my vimrc, here's my full settings if necessary) but the problem persists. The only autocommands I have left in my .vimrc are for highlighting, therefore I'm not sure what other autocommands caused the error :

    augroup vimrc_autocmds
        autocmd!
        autocmd FileType python,rst,c,cpp highlight Excess ctermbg=DarkGrey guibg=Black
        autocmd FileType python,rst,c,cpp match Excess /\%81v.*/
        autocmd FileType python,rst,c,cpp set nowrap
        autocmd FileType python,rst,c,cpp set colorcolumn=80
    augroup END

I have 2 questions :

  1. My muscle memory can't seem to let go of :wq!, is there any modification in vimrc I could do to make :wq! work ?
  2. I'm not familiar with Python yet, why doesn't this error occur with my C++ and C files but only Python ?
raisa_
  • 101
  • 1
  • 3
    Check your autocommands: :au BufWinLeave :au BufLeave :au BufWritePost :au BufWritePost :au ExitPre (and possibly others as well that I do not remember currently). Did you add any specific such autocommands for python files? Note: those could also be in plugins you are using – Christian Brabandt Dec 29 '21 at 13:00
  • 1
    Does this happen on :wq without the bang? Re muscle memory: why the bang? Have you considered ZZ? Have you tried Debugging your vimrc? – D. Ben Knoble Dec 29 '21 at 15:15
  • @ChristianBrabandt Hi, thanks. I had only autocmd BufWinLeave and autocmd BufEnter for tagbar open and close, but I've disabled them as I mentioned in my post. I don't have any :au commands in my vimrc. I have autocommands in my Python settings but it's for highlighting (posted above). There's no other autocommands except for the highlighting autocommands I posted above (my full vimrc is also posted). – raisa_ Dec 29 '21 at 23:18
  • @D.BenKnoble (1) Yes, it happens with :wq as well. (2) Force of habit of supressing warnings (3) Personal preference, unlike ZZ, :wq! will always save even if there's no modification, therefore updating my last edit time which is important for my work. Also, this problem happens with ZZ as well. (4) I haven't, but now I will start to investigate my plugins. Thank you. – raisa_ Dec 29 '21 at 23:32
  • I didn’t look closely, but it seems odd that you have two plugin managers and that you tell one to use the autoload directory to put plugins in (which is probably just wrong…) – D. Ben Knoble Dec 30 '21 at 00:09

0 Answers0